Chris Jerdonek added the comment: Here is a somewhat simpler way to reproduce (following the same definition of x):
>>> dir(x) ... TypeError: object does not provide __dir__ >>> x.__dir__ <built-in method __dir__ of cell object at 0x10c182950> >>> dir(x) ['__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'cell_contents'] The dir() documentation says, "If the object has a method named __dir__(), this method will be called and must return the list of attributes." (from http://docs.python.org/py3k/library/functions.html#dir ) ---------- nosy: +chris.jerdonek title: dir(closure) claims that a closure has no __dir__, only to work later after manually invoking __dir__ from its type -> dir(closure) does not find __dir__ versions: +Python 3.4 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue16268> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com