dir() question
Brian Quinlan
brian at sweetapp.com
Wed Jan 9 17:31:19 EST 2002
More information about the Python-list mailing list
Wed Jan 9 17:31:19 EST 2002
- Previous message (by thread): Closed-source considered harmful (was: JavaScript considered harmful)
- Next message (by thread): dir() question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
The current documentation for dir states: """Without arguments, return the list of names in the current local symbol table. With an argument, attempts to return a list of valid attribute for that object. This information is gleaned from the object's __dict__ attribute, if defined, and from the class or type object. The list is not necessarily complete. For example, for classes, attributes defined in base classes are not included, and for class instances, methods are not included""" This appears to not be the case: >>> class A: ... def a(): ... pass ... >>> dir(A()) ['__doc__', '__module__', 'a'] >>> dir(A) ['__doc__', '__module__', 'a'] 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) Cheers, Brian
- Previous message (by thread): Closed-source considered harmful (was: JavaScript considered harmful)
- Next message (by thread): dir() question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list