[Python-Dev] Consistency questions

Thomas Wouters thomas@xs4all.net
Thu, 20 Jul 2000 17:21:08 +0200

On Thu, Jul 20, 2000 at 09:14:26AM -0500, Skip Montanaro wrote:

>     >> #2. Why doesn't dir( obj ) return inherited methods?

>     Thomas> Because inherited methods (and other inherited attributes)
>     Thomas> aren't stored in an instance's __dict__.

> dir() *could* be smarter and walk up the chain starting at __class__ looking
> for useful stuff to include.  Unfortunately, dir() is written in C so it's
> harder to modify than it ought to be...

I would suggest adding a second, optional argument to dir(), 'recurse' or
such, to add that behaviour. I think I can add that code to dir() if it's
deemed a good idea ;) Turning it on by default would probably break too much

Opinions ?

Thomas Wouters <thomas@xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!