dir() question

Neal Norwitz neal at metaslash.com
Thu Jan 10 03:17:14 CET 2002


Brian Quinlan wrote:
> 
> The current documentation for dir states:
	[doc] 
> This appears to not be the case:
	[example]
> Notice how methods ARE included in class instances. Anyone know which is
> correct, the documentation or the implementation?
> 
> (Also, for classes, base class attributes ARE included)

The doc string in the interpreter is correct for 2.2:

>>> print dir.__doc__
dir([object]) -> list of strings

Return an alphabetized list of names comprising (some of) the attributes
of the given object, and of attributes reachable from it:

No argument:  the names in the current scope.
Module object:  the module attributes.
Type or class object:  its attributes, and recursively the attributes of
    its bases.
Otherwise:  its attributes, its class's attributes, and recursively the
    attributes of its class's base classes.

I'll post a bug on SourceForge to correct.

Thanks,
Neal



More information about the Python-list mailing list