About 14,200,000 results
Open links in new tab
  1. oop - What does 'super' do in Python? - Stack Overflow

    Nov 3, 2015 · When another class subclasses the class you wrote, it could also be inheriting from other classes. And those classes could have an __init__ that comes after this __init__ based …

  2. python - Meaning of @classmethod and @staticmethod for …

    Aug 29, 2012 · Here we have __init__, a typical initializer of Python class instances, which receives arguments as a typical instance method, having the first non-optional argument (self) …

  3. What is the difference between @staticmethod and …

    Sep 26, 2008 · What is the difference between a method decorated with @staticmethod and one decorated with @classmethod?

  4. What does the "at" (@) symbol do in Python? - Stack Overflow

    An @ symbol at the beginning of a line is used for class and function decorators: PEP 318: Decorators Python Decorators - Python Wiki The most common Python decorators are: …

  5. class - Understanding Python super () with __init__ () methods

    Feb 23, 2009 · In Python 2, we were required to call super like this with the defining class's name and self, but we'll avoid this from now on because it's redundant, slower (due to the name …

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

    A class (instance) method has to be aware of it's parent (and parent properties) so you need to pass the method a reference to the parent class (as self). It's just one less implicit rule that you …

  7. python - What is the meaning of single and double underscore …

    Double Underscore (Name Mangling) From the Python docs: Any identifier of the form __spam (at least two leading underscores, at most one trailing underscore) is textually replaced with …

  8. python - Class (static) variables and methods - Stack Overflow

    Sep 16, 2008 · See what the Python tutorial has to say on the subject of classes and class objects. @Steve Johnson has already answered regarding static methods, also documented …

  9. What is the best way of implementing a singleton in Python?

    Jun 10, 2020 · This process is the same as Python asking a class what to do by calling __getattr__ when you reference one of its attributes by doing myclass.attribute. A metaclass …

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

    It's called a "class attribute", as opposed to "instance attributes" that are colour or legs above. Now, to something less canine and more programming-related. As I write below, class to add …