[Patches] [ python-Patches-1498363 ] Improve super() objects support for implicit method calls

SourceForge.net noreply at sourceforge.net
Mon Jul 17 15:05:24 CEST 2006


Patches item #1498363, was opened at 2006-05-31 17:31
Message generated for change (Settings changed) made by gbrandl
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1498363&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 2.6
Status: Open
Resolution: None
Priority: 5
Submitted By: Collin Winter (collinwinter)
>Assigned to: Raymond Hettinger (rhettinger)
Summary: Improve super() objects support for implicit method calls

Initial Comment:
The attached patch lets super() objects pass on
implicit __getitem__, __setitem__, __delitem__, __len__
and __hash__ calls. For example, to use len() with
super() objects, one must currently do something like

super(X, X()).__len__()

Likewise for __getitem__,

super(X, X()).__getitem__(item)

That's ugly.

This patch lets these be spelled as

len(super(X, X())) and super(X, X())[item], respectively.

The patch also includes documentation updates and tests
for the new functionality.

The patch was taken against r46582.

----------------------------------------------------------------------

>Comment By: Georg Brandl (gbrandl)
Date: 2006-07-17 13:05

Message:
Logged In: YES 
user_id=849994

Why only these methods? Why not __add__, __call__ etc.?
Implementing all of these methods is a pain and adds
considerable complexity to typeobject.c.

Frankly, I don't see an improvement since you normally only
call super.__getitem__ in __getitem__, and explicit is
better than implicit. Raymond, do you have a second opinion?

----------------------------------------------------------------------

Comment By: Collin Winter (collinwinter)
Date: 2006-06-27 12:22

Message:
Logged In: YES 
user_id=1344176

The patch has been updated to reflect the current SVN state,
r47124.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1498363&group_id=5470


More information about the Patches mailing list