Patches item #1591665, was opened at 2006-11-06 23:52 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1591665&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Core (C code) Group: Python 2.6 Status: Open Resolution: None Priority: 5 Private: No Submitted By: ganges master (gangesmaster) Assigned to: Nobody/Anonymous (nobody) Summary: adding __dir__ Initial Comment: 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 ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1591665&group_id=5470 _______________________________________________ Patches mailing list [email protected] http://mail.python.org/mailman/listinfo/patches
