About 6,860,000 results
Open links in new tab
  1. Meaning of @classmethod and @staticmethod for beginner

    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) …

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

    What do single and double leading underscores before an object's name represent in Python?

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

    Sep 16, 2008 · How do I create class (i.e. static) variables or methods in Python?

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

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

  6. class - Difference between 'cls' and 'self' in Python classes? - Stack ...

    Why is cls sometimes used instead of self as an argument in Python classes? For example: class Person: def __init__(self, firstname, lastname): self.firstname = firstname self.

  7. oop - What does 'super' do in Python? - Stack Overflow

    Nov 3, 2015 · What's the difference? SomeBaseClass.__init__(self) means to call SomeBaseClass 's __init__. while super().__init__() means to call a bound __init__ from the …

  8. python - How to make a class JSON serializable - Stack Overflow

    Sep 22, 2010 · It's unfortunate that the answers all seem to answer the question "How do I serialize a class?" rather than the action question "How do I make a class serializable?" These …

  9. oop - What are metaclasses in Python? - Stack Overflow

    In Python, a class specifies how the class's instance will behave. Since metaclasses are in charge of class generation, you can write your own custom metaclasses to change how classes are …

  10. python - How to build a basic iterator? - Stack Overflow

    In Python, sequences are iterable too so one way to make an iterable class is to make it behave like a sequence, i.e. give it __getitem__ and __len__ methods. I have tested this on Python 2 …