[Python-3000] Fixing super anyone? (original) (raw)
Collin Winter collinw at gmail.com
Tue Apr 24 03:03:31 CEST 2007
- Previous message: [Python-3000] Fixing super anyone?
- Next message: [Python-3000] Fixing super anyone?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 4/23/07, Jim Jewett <jimjjewett at gmail.com> wrote: [snip]
If we're willing to put up with the magic, then it would work to make super syntactic sugar for
super(thisclass, self) At the moment, I can't see anything wrong with this, but I have a feeling I'm missing something about how the super object should behave on its own.
You mean, have "super.method_name(*args)" expanded by the AST compiler into super(this_class, self).method_name(*args)"? The object reference -> function call change is too much magic; -1.
However, having the AST compiler expand
class A: def m(self): blah() super(self).m() blah()
to
class A: def m(self): super = super_factory(A) blah() super(self).m() blah()
strikes me as an "appropriate" amount of magic. Restricting the magic to a source transformation should enable other Python implementations to implement this relatively easily.
Collin Winter
- Previous message: [Python-3000] Fixing super anyone?
- Next message: [Python-3000] Fixing super anyone?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]