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

Gregory Ewing greg.ewing at canterbury.ac.nz
Sun Feb 1 23:55:21 EST 2015


Steven D'Aprano wrote:
>     [quote]
>     If the object has a method named __dir__(), this method will 
>     be called and must return the list of attributes.
>     [end quote]
> 
> The first inaccuracy is that like all (nearly all?) dunder methods, Python
> only looks for __dir__ on the class, not the instance itself.

It says "method", not "attribute", so technically
it's correct. The methods of an object are defined
by what's in its class.

-- 
Greg



More information about the Python-list mailing list