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

    Jul 8, 2017 · Python doesn't force you on using " self ". You can give it any name you want. But remember the first argument in a method definition is a reference to the object. Python adds …

  2. Why do we use __init__ in Python classes? - Stack Overflow

    5 It seems like you need to use __init__ in Python if you want to correctly initialize mutable attributes of your instances. See the following example:

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

  4. 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, …

  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. 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:

  7. python - __init__ as a constructor? - Stack Overflow

    Dive into Python - It would be tempting but incorrect to call this the constructor of the class. It's tempting, because it looks like a constructor (by convention, __init__ is the first m...

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

    In Python, this corresponds to the class' __init__ method. Python's __new__ is nothing more and nothing less than similar per-class customisation of the "allocate a new instance" part. This of …

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

    Feb 23, 2009 · Just a heads up... with Python 2.7, and I believe ever since super() was introduced in version 2.2, you can only call super() if one of the parents inherit from a class that eventually …

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

    Because of the way diamond inheritance works in python, classes whose base class is object should not call super().__init__(). As you've noticed, doing so would break multiple inheritance …