About 4,050,000 results
Open links in new tab
  1. 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 …

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

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

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

  5. How does Python's super () work with multiple inheritance?

    In fact, multiple inheritance is the only case where super() is of any use. I would not recommend using it with classes using linear inheritance, where it's just useless overhead.

  6. syntax - What does __all__ mean in Python? - Stack Overflow

    650 Explain all in Python? I keep seeing the variable __all__ set in different __init__.py files. What does this do? What does __all__ do? It declares the semantically "public" names from a …

  7. python - Should __init__ () call the parent class's __init__ ...

    71 In Python, calling the super-class' __init__ is optional. If you call it, it is then also optional whether to use the super identifier, or whether to explicitly name the super class:

  8. How do I write good/correct package __init__.py files

    Although all the functionality is implemented in modules and subpackages, your package docstring is the place to document where to start. For example, consider the python email …

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

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

    In fact, it's a good idea to just always inherit from object unless you're writing backwards compat code for very old Python versions. In Python 3, old-style classes are gone and inheritance …