How Can I Get A List Of All Special Methods Available?

- 1 answer

Special methods are for example (in Django):

def __wrapper__
def __deepcopy__
def __mod__
def __cmp__


A list of special method names is here, but it's not an exhaustive of magic names -- for example, methods __copy__ and __deepcopy__ are mentioned here instead, the __all__ variable is here, class attributes such as __name__, __bases__, etc are here, and so on. I don't know of any single authoritative list of all such names defined in any given release of the language.

However, if you want to check on any single given special name, say __foo__, just search for it in the "Quick search" box of the Python docs (any of the above URLs will do!) -- this way you will find it if it's officially part of the language, and if you don't find it you'll know it is a mistaken usage on the part of some package or framework that's violating the language's conventions.