The above statement seems superfluous, and ASAIK offers nothing new to the App.
Why is it needed ? Bob
Mike Driscoll
unread,
Jun 22, 2019, 8:14:04 PM6/22/19
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to wxPytho...@googlegroups.com
It's not needed. But it doesn't hurt anything either. Also I think it is recommended to use super() that way I'm Python 3.
So while it's not needed it is conventional to use it in the latest version of Python.
Mike
--
Gerhard Schmidt
unread,
Jun 25, 2019, 1:52:39 AM6/25/19
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Mike Driscoll
Hi,
it might not be needed there but it's needed to ensure that all __init__
methods of any superclasses are called.
Not calling super in all __init__ methods might break initialization
when deriving from multiple classes way down the hierarchy.
an example
you have a class A, Class B derived from A and Class C derived from
Class B and a Class D that has nothing to do with class A or B.
The __init__ method of class C call super which calls the B.__init__, in
B.__init__ super is called again and A.__init__ is called. if A.__init__
doesn't call super the execution goes back to B.__init__ and C.__init__
after the methods are finished, but D.__init__ is never called because
the super call in A.__init__ will trigger that.
That's what in experienced in one of my projects I'm migrated from
python 2 to python3. I might be wrong here, but that's what I'm
experiencing.
Before super you called the __init__ method of any class you derived
from directly. Now the super call has to handle that.