Re: [Python-ideas] [Python-Dev] features i'd like [Python 3000] ... #3: fix super()

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?

On 1/6/07, Eduardo EdCrypt O. Padoan eopadoan@altavix.com wrote:
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?
Ops: But *I* think *it* belongs more to Python-Ideas list, ok?
participants (1)
-
Eduardo "EdCrypt" O. Padoan