[Python-Dev] Problems with the new super()

Andrew McNabb amcnabb at mcnabbs.org
Fri May 2 00:33:54 CEST 2008


On Thu, May 01, 2008 at 12:55:22PM -0700, Guido van Rossum wrote:
> 
> I'm not proud of this, but I don't see a way around it. The
> alternative would be to make it a keyword, which seemed excessive
> (plus, it would be odd if super() were a keyword when self is not).
> There were long discussions about various possible ways to implement
> something like this, and they all had their downsides. (The PEP still
> isn't fixed to describe the status quo.)

I remember some brainstorms about treating more like self.  I'm not sure
if these were thought through all the way, but I remember seeing
something like:

class MyClass(Super1, Super2):
    # This method requires super:
    @requires_super
    def __init__(self, super, **kwds):
        super(**kwds)

    # This method doesn't require super:
    def some_method(self):
        pass

I'm sure there are drawbacks, but it fits in my head.  Using super in
Python 2.0 is verbose but simple.  However, I'm a little scared of super
in Python 3.0.  I guess I'm probably just a wimp.


-- 
Andrew McNabb
http://www.mcnabbs.org/andrew/
PGP Fingerprint: 8A17 B57C 6879 1863 DE55  8012 AB4D 6098 8826 6868
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/python-dev/attachments/20080501/32c89f13/attachment.pgp>


More information about the Python-Dev mailing list