[IPython-dev] New display methods, should we fine-tune our naming decision?

Robert Kern robert.kern at gmail.com
Wed Feb 2 12:41:17 EST 2011


On 2/2/11 9:09 AM, Walter Dörwald wrote:
> On 02.02.11 03:16, MinRK wrote:
>
>> [...]
>> An alternative to developers writing methods in their classes would be
>> for the Display system to use its own lookup table for representation
>> methods, and provide an extension API for modules, IPython,
>> third-parties, or users to register additional methods for classes.
>>   This would be more elaborate, but would make the display system a
>> better Python citizen, and would eliminate the possiblity of collision
>> with other projects' private conventions.
>
> Why not use a generic function (i.e.
> http://pypi.python.org/pypi/simplegeneric) for the method registry?

Generic functions (as implemented by simplegeneric) are global, and it is 
difficult to "unregister" functions. The dispatch algorithm in DisplayFormatter 
is quite similar to that of simplegeneric, though.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the IPython-dev mailing list