About 3,300,000 results
Open links in new tab
  1. oop - What do __init__ and self do in Python? - Stack Overflow

    Jul 8, 2017 · We could use any other legal Python name, but you will likely get tarred and feathered by other Python programmers if you change it to something else. __init__ is a …

  2. 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 …

  3. python - Duda con clases. ¿Para que sirve __init__? - Stack …

    Aug 30, 2017 · 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, …

  4. class - __new__ and __init__ in Python - Stack Overflow

    how I should structure the class using __init__ and __new__ as they are different and both accepts arbitrary arguments besides default first argument. Only rarely will you have to worry …

  5. python - What is __init__.py for? - Stack Overflow

    Here's the documentation. Python defines two types of packages, regular packages and namespace packages. Regular packages are traditional packages as they existed in Python …

  6. python - Calling parent class __init__ with multiple inheritance, …

    This is why your code didn't work correctly. Because of the way diamond inheritance works in python, classes whose base class is object should not call super().__init__(). As you've …

  7. Is it necessary to include __init__ as the first function every time in ...

    In addition to other answers, one point in your question that has not been addressed : Is it necessary to include __init__ as the first function everytime in a class in Python? The answer …

  8. Python constructors and __init__ - Stack Overflow

    Jan 24, 2012 · The python constructor is __new__. Python uses automatic two-phase initialisation - __new__ returns a valid but (usually) unpopulated object (see bool for a counter-example), …

  9. Understanding Python super() with __init__() methods

    Feb 23, 2009 · Why is super() used? Is there a difference between using Base.__init__ and super().__init__? class Base(object): def __init__(self): print "Base created&quot ...

  10. python - Why is __init__ () always called after __new__ ()? - Stack ...

    Use __new__ when you need to control the creation of a new instance. Use __init__ when you need to control initialization of a new instance. __new__ is the first step of instance creation. …