On 4/23/07, Jim Jewett <[EMAIL PROTECTED]> wrote:
[snip]
> If we're willing to put up with the magic, then it would work to make
> super syntactic sugar for
>
>     super(__this_class__, 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
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to