Special methods are for example (in Django):
def __wrapper__
def __deepcopy__
def __mod__
def __cmp__
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.