this has gotten much better in python 3.3...
Like how?
this has gotten much better in python 3.3...
Like how?
Bo�tjan Mejak wrote:
> this has gotten much better in python 3.3...
Like how?
You can just use super().foo() and not need to specify the class name or instance object.
--
Robin Dunn
Software Craftsman
> this has gotten much better in python 3.3...
Like how?
You can just use super().foo() and not need to specify the class name or
instance object.
though Im pretty sure this is just easier syntax -- all teh things
that make super() "harmfull" or "super" are still there...
-Chris
On Wed, Jun 5, 2013 at 9:55 AM, Robin Dunn <robin@alldunn.com> wrote:
--
Robin Dunn
Software Craftsman
http://wxPython.org--
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
Chris Barker - NOAA Federal wrote:
On Wed, Jun 5, 2013 at 9:55 AM, Robin Dunn<robin@alldunn.com> wrote:
> this has gotten much better in python 3.3...
Like how?
You can just use super().foo() and not need to specify the class name or
instance object.though Im pretty sure this is just easier syntax -- all teh things
that make super() "harmfull" or "super" are still there...
True.
Sometimes I feel a little guilty for still using wx.Frame.__init__(self, ...) in my code instead of super, but then I see code from someone who is even more of a pythonista than I am who is still doing it the old way too and I feel better.
--
Robin Dunn
Software Craftsman
Chris Barker - NOAA Federal wrote:
Sometimes I feel a little guilty for still using wx.Frame.__init__(self,
...) in my code instead of super, but then I see code from someone who is
even more of a pythonista than I am who is still doing it the old way too
and I feel better.
I don't know about that...
I spent some time mulling over all this recently because:
1) on my current project, one of the key developers figured that
super() was the "right" way to do it..so started putting it in
everywhere, but things got messy
2) I'm teaching pyton these days, and needed to teach it!
My thoughts:
super() only works right if various conditions are met:
1) it's used everywhere in the subclassing hierarchy
2) the method signature is the same up the class hierarchy (you can
add args on the front, but buyer beware...
3) you want all the super-classes' matching methods called
4) probably others...
the trick was (2) -- one way to enforce that is to simply make every
method signature: (*args, **kwags), but then you are putting the onus
on the code to check all the arguments -- what a mess! Plus you lose
the nice self-documenting..
So my take away: if you're use-case does not fit well with super(),
then super() is not the right solution -- so don't use it, rather than
shoe-horning your code into it to try to do the "right" thing.
Also, explicit is better than implicit, so I kind of like explicit
nature of specifically calling the method on the superclass you want
to call.
-CHB
On Wed, Jun 5, 2013 at 10:09 AM, Robin Dunn <robin@alldunn.com> wrote:
--
Robin Dunn
Software Craftsman
http://wxPython.org--
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