The difference between __XX__ and XX method
lists at cheimes.de
Tue Sep 9 00:03:05 CEST 2008
AON LAZIO wrote:
> Hi, Pythoners.
> I would like to know that in some class, it uses __XX__ but in some it
> uses only XX
> for example,
> class Test:
> def __som__(self):
> def som(self):
> What does "__XX__" make the method different from XX?
> Thanks in advance
The form __method__ is reserved for internal methods also known as magic
methods. In general you must not name your own methods or attributes
__XX__ because the core of Python reserves all rights on the __*__
Some well know magic methods are __init__, __getattr__, __add__ etc. You
can find a complete lists in the Python language reference.
More information about the Python-list