约 47,200 个结果
在新选项卡中打开链接
  1. Understanding Python super() with __init__() methods

    2009年2月23日 · 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 …

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

    You can – and should, of course, play around with the example, add super() calls, see what happens, and gain a deeper understanding of Python's inheritance model.

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

    2015年11月3日 · Python linearizes a complicated inheritance tree via the C3 linearization algorithm to create a Method Resolution Order (MRO). We want methods to be looked up in …

  4. python - How do I initialize the base (super) class? - Stack Overflow

    Python (until version 3) supports "old-style" and new-style classes. New-style classes are derived from object and are what you are using, and invoke their base class through super(), e.g.

  5. python 2.x - correct way to use super (argument passing ... - Stack ...

    2012年1月23日 · So I was following Python's Super Considered Harmful, and went to test out his examples. However, Example 1-3, which is supposed to show the correct way of calling super …

  6. python - Understanding difference between parent class init () and ...

    2022年9月6日 · Understanding difference between parent class init () and super.__init__ Asked 3 years ago Modified 3 years ago Viewed 3k times

  7. python - Super init vs. parent.__init__ - Stack Overflow

    super has a lesser benefit of reducing requires changes if you rename or change the base class. In python 3, the arguments to super are optional, so you can just do super().__init__().

  8. python - When is the method __post_init__ not called? - Stack …

    2022年9月10日 · I found the issue where was conversation about an explict call of parent's __post_init__ method using super(), but if I try this: from dataclasses import dataclass …

  9. When to call Python's super ().__init__ ()? - Stack Overflow

    2014年11月15日 · 18 Yes, it is perfectly safe to call other things before super(). Python doesn't set an order, and there are plenty of use-cases for this. Note that super().__init__() call is just …

  10. Is it necessary to call super().__init__() explicitly in python?

    2020年2月1日 · If you override the __init__ method of the superclass, then the __init__ method of the subclass needs to explicitly call it if that is the intended behavior, yes. Your mental model …