[Python-3000] Fixing super anyone?

Thomas Wouters thomas at python.org
Mon Apr 23 15:07:05 CEST 2007


On 4/23/07, Michele Cella <michele.cella at gmail.com> wrote:

> Calling a method:
>
>         self.method(arg)
>
> Calling a super method:
>
>         super self.method(arg)
>
> That's consistent with:
>         * the way you call any other method
>         * the way you use any other keyword


But how would it *work*? I assume you want 'super' to take a single
expression, and be an expression itself. How does it know which instance you
want to 'super'? Does it specialcase the variable named 'self'? Threat
'everything up to the first dot' as 'the instance'? Specialcase the first
argument to the method? (That's what 'super.foo()' would do.) How would you
do things like:

  # call the supermethod 'register' with the nonsuper 'callback':
  super.register(self.callback)
  # call the nonsuper 'register' with the supermethod 'callback'
  self.register(super.callback)
  # call the 'frominstance' method of the 'innerclass' attribute on the
superclass
  super.innerclass.frominstance(self)

-- 
Thomas Wouters <thomas at python.org>

Hi! I'm a .signature virus! copy me into your .signature file to help me
spread!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-3000/attachments/20070423/e1da0542/attachment.html 


More information about the Python-3000 mailing list