[Patches] [ python-Patches-1727209 ] First steps towards new super (PEP 367)
SourceForge.net
noreply at sourceforge.net
Tue May 29 05:23:23 CEST 2007
Patches item #1727209, was opened at 2007-05-28 22:30
Message generated for change (Comment added) made by gvanrossum
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1727209&group_id=5470
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: Core (C code)
Group: Python 3000
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Guido van Rossum (gvanrossum)
Assigned to: Guido van Rossum (gvanrossum)
Summary: First steps towards new super (PEP 367)
Initial Comment:
A half-assed start of an implementation for super.
This is lacking parser support; instead, for now, you have to have a keyword-only argument named super, e.g.
def foo(self, arg, *, super):
return super.foo(arg) + 1
Note that the first version changes method lookup for bound method lookup but not yet for unbound method lookup. E.g. if f is defined in class B, and class C derives from B, C().f returns a bound method object whose im_class attribute is set to B (as opposed to C as it used to be) but C.f returns an unbound method object with im_class set to C. (I hope to this in a later version.)
----------------------------------------------------------------------
>Comment By: Guido van Rossum (gvanrossum)
Date: 2007-05-28 23:23
Message:
Logged In: YES
user_id=6380
Originator: YES
And a new sup.py example demonstrating that the new patch works.
File Added: sup.py
----------------------------------------------------------------------
Comment By: Guido van Rossum (gvanrossum)
Date: 2007-05-28 23:22
Message:
Logged In: YES
user_id=6380
Originator: YES
Here's a new version of the patch where C.f.im_class (in the above
example) correctly returns B.
File Added: super.diff
----------------------------------------------------------------------
Comment By: Guido van Rossum (gvanrossum)
Date: 2007-05-28 22:31
Message:
Logged In: YES
user_id=6380
Originator: YES
Here is sup.py, a small demo of how this is supposed to work.
File Added: sup.py
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1727209&group_id=5470
More information about the Patches
mailing list