|
|
|
|
|
by klibertp
3801 days ago
|
|
You're wrong and you confuse two different things. So called "magic" methods, which are called by Python in various circumstances, are surrounded by double underscores. One of such methods is __init__, which works as an initializer for newly created objects. The other thing is that all methods, unless otherwise specified, take a pointer to the current object as a first argument. So when defining an initializer that takes no arguments from the user you write: def __init__(self): # etc.
I think only __init__ and __name__ are widely used in Python, all the other such methods are very special purpose and very rarely used outside of deep library code.BTW: Being "ugly" or not is not the best characteristic you can base your opinion of a language on. |
|