Because dir
uses a specialized implementation 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.