[Python-Dev] __dir__, part 2

Fredrik Lundh fredrik at pythonware.com
Fri Nov 10 21:26:34 CET 2006


Guido van Rossum wrote:

> I think that ought to go into the guidlines for what's an acceptable
> __dir__ implementation. We don't try to stop people from overriding
> __add__ as subtraction either.

to me, overriding dir() is a lot more like overriding id() than over- 
riding "+".  I don't think an object should be allowed to lie to the 
introspection mechanisms.

</F>



More information about the Python-Dev mailing list