Author gangesmaster
Recipients
Date 2006-11-06.21:52:36
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
in accordance with 
http://mail.python.org/pipermail/python-dev/2006-November/069865.html

i've written a patch that allows objects to define their
own introspection mechanisms, by providing __dir__.
with this patch:
* dir() returns the locals. this is done in builtin_dir()
* dir(obj) returns the attributes of obj, 
by invoking PyObject_Dir()
* if obj->ob_type has "__dir__", it is used. 
note that it must return a list!
* otherwise, use default the mechanism of collecting 
attributes
* for module objects, return __dict__.keys()
* for type objects, return __dict__.keys() +
dir(obj.__base__)
* for all other objects, return __dict__.keys() + 
__members__ + __methods__ + dir(obj.__class__)
* builtin_dir takes care of sorting the list
History
Date User Action Args
2007-08-23 15:55:15adminlinkissue1591665 messages
2007-08-23 15:55:15admincreate