dunder-docs (was Python is DOOMED! Again!)

Vito De Tullio vito.detullio at gmail.com
Mon Feb 2 00:26:55 EST 2015


Steven D'Aprano wrote:

> Checking the REPL first would have revealed that [].__dir__ raises
> AttributeError. In other words, lists don't have a __dir__ method.

?

Python 3.4.2 (default, Nov 29 2014, 00:45:45) 
[GCC 4.8.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> [].__dir__()
['sort', '__contains__', '__init__', '__ge__', 'count', '__class__', 
'__format__', '__mul__', 'index', '__rmul__', '__hash__', '__iter__', 
'clear', '__subclasshook__', '__getitem__', 'reverse', 'append', '__ne__', 
'pop', '__reduce__', '__add__', 'extend', '__gt__', '__sizeof__', 
'__setattr__', '__imul__', '__dir__', '__le__', 'insert', '__repr__', 
'__str__', '__getattribute__', '__len__', '__lt__', 'remove', '__new__', 
'__reduce_ex__', 'copy', '__reversed__', '__delattr__', '__eq__', 
'__setitem__', '__iadd__', '__doc__', '__delitem__']
>>> 


-- 
By ZeD




More information about the Python-list mailing list