Why does dir of a module show no __dict__? (python)
Question: For example:

    
    
    >>> import os
    >>> '__dict__' in dir(os)
    False
    

But `os.__dict__` shows there is a `__dict__` attribute.


Answer: Because `dir` uses a [specialized
implementation](http://hg.python.org/cpython/file/30b3798782f1/Objects/object.c#l1829)
for modules, which returns all the keys in the module's `__dict__`, and thus
neglects to include the `__dict__` attribute itself.

It is not clear from reading the source code whether this is intentional.

