[Python-ideas] Should we improve `dir`?

David Halter davidhalter88 at gmail.com
Sat Sep 14 21:15:14 CEST 2013


I recently stumbled over `dir()` not working correctly in the case of
classes:

http://jedidjah.ch/code/2013/9/8/wrong_dir_function/

In short:

`dir` doesn't list the `type` methods, which it should in my opinion,
because there are very important attributes in there like `__name__` or
`__bases__`.

This led to some confusion in the past, e.g.
http://www.gossamer-threads.com/lists/python/python/507363.

The long version is in the above link.

After discussions, I realized that I should probably bring this up in
python-ideas, I think the current implementation can be very confusing for
people trying to introspect classes with `dir`, which is IMHO its typical
use case.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130914/cec3b250/attachment-0001.html>


More information about the Python-ideas mailing list