Global web icon
stackoverflow.com
https://stackoverflow.com/questions/625083/what-do…
oop - What do __init__ and self do in Python? - Stack Overflow
class Point: def __init__(self, x, y): _x = x _y = y Your x and y parameters would be stored in variables on the stack and would be discarded when the init method goes out of scope. Setting those variables as self._x and self._y sets those variables as members of the Point object (accessible for the lifetime of the object). N.B. Some clarification of the use of the word "constructor" in this ...
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/8609153/why-do…
Why do we use __init__ in Python classes? - Stack Overflow
The characteristic of a type e.g. Germans (hans) are usually defined through the constructor (in python : __init__) at the moment of the instantiation. This is the point where you define a class to become an object.
Global web icon
stackoverflow.com
https://es.stackoverflow.com/questions/79502/duda-…
python - Duda con clases. ¿Para que sirve __init__? - Stack Overflow en ...
Estoy empezando en esto de programar y me estoy metiendo en la POO. En python, ¿Porqué en las clases se pone __init__?. Y esto, a lo mejor puede sonar estúpido, pero ¿Por qué usar clases cuando se ...
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/9685045/unders…
understanding python self and init - Stack Overflow
Well I am new to python, coming from basic C background and having confusion understanding it. Stating what I understand, before what I don't understand. Statement 0: FileInfo is inheriting from class UserDict Statement 1: __init__ is not a constructor, however after the class instantiates, this is the first method that is defined.
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/6854080/is-it-…
Is it necessary to include __init__ as the first function every time in ...
80 In Python, I want to know if it is necessary to include __init__ as the first method while creating a class, as in the example below:
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/8106900/new-an…
class - __new__ and __init__ in Python - Stack Overflow
For reference, check out the requirements for __new__ in the Python Language Reference. Edit: ok, here's an example of potentially useful use of __new__. The class Eel keeps track of how many eels are alive in the process and refuses to allocate if this exceeds some maximum.
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/5166473/inheri…
Inheritance and init method in Python - Stack Overflow
In the first situation, Num2 is extending the class Num and since you are not redefining the special method named __init__() in Num2, it gets inherited from Num. When a class defines an __init__() method, class instantiation automatically invokes __init__() for the newly-created class instance. In the second situation, since you are redefining __init__() in Num2 you need to explicitly call the ...
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/9663562/what-i…
What is the difference between __init__ and __call__?
init is called when instantiating the class: myfoo = Foo (1,4,7.8) call is a template to call the already instantiated class to do something let's say class Foo:\ def __call__ (self, zzz) Then, myfoo (12) calls the class to do what that class does.
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/33128325/how-t…
How to set class attribute with await in __init__ - Stack Overflow
How can I define a class with await in the constructor or class body? For example what I want: import asyncio # some code class Foo(object): async def __init__(self, settings): self.
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/6013844/python…
class - Python __init__ syntax - Stack Overflow
But super() only works with new-style classes in Python 2, or Python 3. It doesn't work with old-style classes in Python 2. Make sure your base class is a new-style class (inherits from object).