[Python-3000] Fixing super anyone?

Thomas Lee tom at vector-seven.com
Tue Apr 24 03:32:59 CEST 2007


Collin Winter wrote:
> 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()
>   

I'm sold on the super(self) syntax and whacked together a quick & dirty 
patch. I made my changes in Objects/super.c, rather than the AST as you 
suggest. Determining __this_class__ ('A' in your example) without 
touching the AST is obviously going to be problematic, but even *with* 
the AST how would you propose we determine the "current" class?

I've attached my patch irrespective. All relevant changes are within 
super_init.

Forgive the ignorance, I'm relatively new to this stuff :)

Cheers,
Tom


More information about the Python-3000 mailing list