Bugs item #1981509, was opened at 2008-06-01 21:41
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=114534&aid=1981509&group_id=14534
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Orestis Markou (orestis82)
Assigned to: Nobody/Anonymous (nobody)
Summary: Cannot call objc.super on NSObject
Initial Comment:
While super(type, self) works fine when subclassing types higher up in the class hierarchy, for plain old subclasses of NSObject (a common case with appdelegates), super will not work.
A workaround is to use NSObject.init(self), but it's potentially confusing for newcomers.
Example:
>>> from Foundation import *
>>> class Test(NSObject):
... def init(self):
... return super(NSObject, self).init()
...
>>> t = Test.alloc().init()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 3, in init
AttributeError: 'objc.super' object has no attribute 'init'
>>> from AppKit import *
>>> class Test2(NSDocument):
... def init(self):
... return super(NSDocument, self).init()
...
>>> t = Test2.alloc().init()
>>>
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=114534&aid=1981509&group_id=14534
|