This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author davidhalter
Recipients davidhalter
Date 2013-09-11.06:20:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1378880451.82.0.998683899119.issue19002@psf.upfronthosting.co.za>
In-reply-to
Content
I recently stumbled over the ``dir`` function not working correctly with classes. This means that ``dir(object)`` won't list ``object.__bases__`` or ``object.__subclasses`` (and many other useful methods).

I think that we should change that. The C function ``type_dir`` (in ``Objects/typeobject.c``) has a documentation entry which states:

"We deliberately don't suck up its __class__, as methods belonging to the metaclass would probably be more confusing than helpful."

I think that that's not true. The current behaviour of ``dir`` is way more confusing, since ``dir`` is typically the tool how we find out about magic methods.

I wrote about it in more details here: http://jedidjah.ch/code/2013/9/8/wrong_dir_function/
History
Date User Action Args
2013-09-11 06:20:51davidhaltersetrecipients: + davidhalter
2013-09-11 06:20:51davidhaltersetmessageid: <1378880451.82.0.998683899119.issue19002@psf.upfronthosting.co.za>
2013-09-11 06:20:51davidhalterlinkissue19002 messages
2013-09-11 06:20:50davidhaltercreate