What is the benefit of using the super() method in a class' __init__ overload?
well....
If you do some googling, you'll find two primariry articles about super:
"Python's Super Considered Harmful"
and
"Python’s super() considered super!"
so there is some debate about this, to say the least. However, those
two posts agree to some extent, at least about what has to be the case
in order to be able to use super()
But it really only gets complicated (and useful) with multiple
inheritance. (and note, all I've read about it hav not made this
clear: super() will do something different that just calling the
superclass directly, even if you call the same one that super()
finds...)
in this case:
class MyFrame(wx.Frame):
def __init__(self, *arg, **kwargs):
wx.Frame.__init__(self, *args, **kwargs)
---versus---
super(MyFrame, self).__init__(*args, **kwargs)
it's really just syntactic sugar -- if nothing else, it does let you
change what your class is sub-classing from without changing that name
in two (or more) places....
At this level, it's a taste thing -- for my part, I vacillate, but
given how ugly the super call is, I usually don't use it (this has
gotten much better in py3.3...)
-Chris
···
On Wed, Jun 5, 2013 at 8:58 AM, "Boštjan Mejak" <mejak.bost@gmail.com> wrote:
--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@noaa.gov