

Python's dir function is wrong - zedpm
http://jedidjah.ch/code/2013/9/8/wrong_dir_function/

======
ramalho
Plase read the docs for the dir function before it's source code, before
complaining so loud. Direct quote "Note Because dir() is supplied primarily as
a convenience for use at an interactive prompt, it tries to supply an
interesting set of names more than it tries to supply a rigorously or
consistently defined set of names, and its detailed behavior may change across
releases. For example, metaclass attributes are not in the result list when
the argument is a class."

~~~
sigzero
The ticket was also closed by the author as it what pretty much determined to
be a "won't fix".

[http://bugs.python.org/issue19002](http://bugs.python.org/issue19002)

~~~
masklinn
It was closed by R. David Murray (a Python core developer), not David Halter
(the author)

~~~
scott_s
And for all those interested in the blog post, I recommend you read David
Murray's reason and suggestion.

~~~
jdboyd
And the link straight to that is
[http://bugs.python.org/issue19002#msg197498](http://bugs.python.org/issue19002#msg197498)

------
jabwork
Python objects can override __dir__, which is all dir() calls anyway.

It looks like this is all for an autocompletion library. Why not just write
jedi.dir (jedir?)

~~~
Patrick_Devine
I personally haven't wanted dir() to do this, however I guess I could see the
case for an extension to dir such as:

dir(inst, traverseclass=True)

Maybe the author should write a PEP?

------
zzzeek
practicality beats purity

~~~
rantanplan
Yes, but purity generates a lot more blog posts than practicality. Or so it
seems.

