Documentaion of dunder methods

Steven D'Aprano steve at pearwood.info
Mon May 25 22:17:30 EDT 2015


PEP 8 states that developers should never invent their own dunder methods:

    __double_leading_and_trailing_underscore__ : 
        "magic" objects or attributes that live in user-controlled
        namespaces. E.g. __init__ , __import__ or __file__ . Never 
        invent such names; only use them as documented. 

https://www.python.org/dev/peps/pep-0008/#naming-conventions


In other words, dunder methods are reserved for use by the core developers
for the use of the Python interpreter.

Apart from PEP 8, is this documented anywhere in the official documentation?
If so, I have been unable to find it.



-- 
Steven




More information about the Python-list mailing list