About 23,300 results
Open links in new tab
  1. class - Python classes explained - Stack Overflow

    Python 2 allows classes that don't inherit from object, which was added in version 2.2. They behave differently from "new-style classes" in a few ways, and you've found a couple. They …

  2. python - What is the purpose of the `self` parameter? Why is it …

    Python is not a language built for Object Oriented Programming, unlike Java or C++. First off, methods belong to either an entire class (static method) or an object (instance) of the class …

  3. oop - What do __init__ and self do in Python? - Stack Overflow

    Jul 8, 2017 · Yep, you are right, these are oop constructs. __init__ is the constructor for a class. The self parameter refers to the instance of the object (like this in C++).

  4. Difference between Module and Class in Python - Stack Overflow

    Aug 24, 2022 · So a module in python is simply a way to organize the code, and it contains either python classes or just functions. If you need those classes or functions in your project, you just …

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

  6. python - What's the pythonic way to use getters and setters?

    Keep in mind that Python provides an easy path to future enhancement, should you find that a simple data attribute needs to grow functional behavior. In that case, use properties to hide …

  7. How do python classes work? - Stack Overflow

    Feb 16, 2009 · The class definitions of the boto classes I am using contain class variables for Manager, which in turn serve as a default value if no Manager is passed to the __init__() of …

  8. What is the difference between an instance and an object in Python?

    May 10, 2020 · In Python, everything is an object. Moreover in Python objects are instances of classes, so it follows that every object is also an instance of some class *. However, we …

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

    Dec 23, 2011 · The point of classes is to do something sensible for every different crawler. Classes are not functions, nor something that can compare to functions (well, not until you're a …

  10. python - Usage of __slots__? - Stack Overflow

    Jan 23, 2009 · This is consistent with the history of Python, from Unifying types and classes in Python 2.2. If you subclass a built-in type, extra space is automatically added to the instances …

Refresh