[Python-Dev] features i'd like [Python 3000] ... #3: fix super()
Eduardo "EdCrypt" O. Padoan
eopadoan at altavix.com
Sat Jan 6 18:16:19 CET 2007
> I was bitten by the urge to play with this today, and modified my
> previous "self" hack to handle "super" also, so that the following
> code works:
>
> class D (C):
> @method
> def sum(n):
> return super.sum(n * 2) - self.base
>
> Posted as "evil2.py" here:
>
> http://www.lag.net/robey/code/surf/
>
> Because hacking "super" requires having the class object handy, this
> one needs a metaclass to do its magic, which is a shame. I guess if
> it was implemented inside the cpython compiler, it would be less of a
> problem.
BTW, a "super-only" version of this decortor (that I think could be
called "implement") has some more chances in Python. But think
belongs more to Python-Ideas list, ok?
--
EduardoOPadoan (eopadoan->altavix::com)
Bookmarks: http://del.icio.us/edcrypt
Blog: http://edcrypt.blogspot.com
Jabber: edcrypt at jabber dot org
ICQ: 161480283
GTalk: eduardo dot padoan at gmail dot com
MSN: eopadoan at altavix dot com
More information about the Python-Dev
mailing list