Trying to understand super() I made these two examples but they return the same results.
This is with super()
class Person1():
def __init__(self, name):
self.name = name
class EmailPerson1(Person1):
def __init__(self, name, email):
super().__init__(name)
self.email = email
bob2 = Person('Dim')
bob = EmailPerson1('Bob Frapples', 'bob@frapples.com')
bob.name
'Bob Frapples'
and this without super()
class Person():
def __init__(self, name):
self.name = name
class EmailPerson(Person):
def __init__(self, name, email):
self.name = name
self.email = email
bob2 = Person('Dim')
bob1 = EmailPerson('Bob Frapples', 'bob@frapples.com')
bob1.name
'Bob Frapples'
What is the difference? The first version should use the name from the parent class I think.