[IPython-dev] _repr_pretty_() for dict subclasses
Fri Mar 30 06:14:52 CDT 2012
On 23.03.12 18:24, Robert Kern wrote:
> On 3/23/12 5:07 PM, Walter Dörwald wrote:
>> Hello all!
>> I'm currently experimenting with the new pretty printing framework. It
>> seems there's a problem with the _repr_pretty_ method in dict subclasses:
>> The proper solution would probably be to walk the mro and see if there's
>> either a registered printer or a _repr_pretty_ method for the class.
>> However I'm not sure if there's a reliable way to check whether a method
>> is implemented in the class itself or inherited from any of the base
> It will be in the __dict__ of the class that defines it. The algorithm should
> probably be:
> 1. Try to find registered singleton printers for the type.
> 2. Walk up the MRO:
> a. Look in type_printers for the current class.
> b. Then look for _repr_pretty_ in the current class's __dict__.
OK, I have a patch ready for this:
More information about the IPython-dev