Commit b3d8fec0 by Yannick Jadoul Committed by GitHub

Adapt code example in advanced/classes.rst to new handling of forgetting to call…

Adapt code example in advanced/classes.rst to new handling of forgetting to call the superclass __init__ (#2429)
parent 4493751a
......@@ -159,7 +159,7 @@ Here is an example:
class Dachshund(Dog):
def __init__(self, name):
Dog.__init__(self) # Without this, undefined behavior may occur if the C++ portions are referenced.
Dog.__init__(self) # Without this, a TypeError is raised.
self.name = name
def bark(self):
return "yap!"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment