Message197471
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/ |
|
Date |
User |
Action |
Args |
2013-09-11 06:20:51 | davidhalter | set | recipients:
+ davidhalter |
2013-09-11 06:20:51 | davidhalter | set | messageid: <1378880451.82.0.998683899119.issue19002@psf.upfronthosting.co.za> |
2013-09-11 06:20:51 | davidhalter | link | issue19002 messages |
2013-09-11 06:20:50 | davidhalter | create | |
|