No, there is no reason not to use the Python 3 style. In fact, the wxPython Cookbook by Cody Precord uses that style throughout most of the book. The examples on the website are a bit old.
On Mon, Nov 24, 2014 at 6:02 AM, Mark Summerfield list@qtrac.plus.com wrote:
class MyDialog(wx.Dialog):
def __init__(self, parent, ID, title):
wx.Dialog.__init__(self)
self.SetExtraStyle(wx.FRAME_EX_CONTEXTHELP)
self.Create(parent, ID, title)
Is there any reason it can't be written in "purer" Python 3 style?
Is there any reason it can't be written in "purer" Python 3 style?
Of course it can. Does it matter? No. Is it important? No. This is
a style issue. When Phoenix issues are ranked in order of importance,
this is #22,139. Please continue to hold. Your call is very important
to us.
···
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
It is valid but I personally would consider it poor style.
The other problem with both Class.method(self) and super(Class, self).method() is that you must be explicit about the class, whereas with super().method(), Python figures out the class for you.
Why does this matter? Well, probably it doesn’t in most cases. But if you decide to change your class hierarchy and put a class in between this subclass and the original parent class, you’d have to change all Class references to the new class – super(DerivedClass, self).method(); but any super().method() calls will just do the right thing.
···
On Monday, November 24, 2014 8:26:33 PM UTC, Nathan McCorkle wrote:
On Monday, November 24, 2014 12:20:07 PM UTC-8, Mark Summerfield wrote:
Hi Werner,
The call you show - super(Class, self).method() is necessary in Python 2; but in Python 3, super().method() is sufficient.
But is the former (super(Class, self)) erroneous in Python 3, or just verbose?