[Python-3000] [Python-Dev] Pre-pre PEP for 'super' keyword (original) (raw)
Tim Delaney tcdelaney at optusnet.com.au
Mon Apr 30 13:38:30 CEST 2007
- Previous message: [Python-3000] [Python-Dev] Pre-pre PEP for 'super' keyword
- Next message: [Python-3000] [Python-Dev] Pre-pre PEP for 'super' keyword
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
From: "Delaney, Timothy (Tim)" <tdelaney at avaya.com>
Sorry - this is related to my proposal that the following two bits of code behave the same:
class A(object): def f(self, *p, **kw): super.f(*p, **kw) class A(object): def f(self, *p, **kw): super(*p, **kw) But as has been pointed out, this creates an ambiguity with: class A(object): def f(self, *p, **kw): super.call(*p, **kw) so I want to see if I can resolve it.
A 'super' instance would be callable, without being able to access it's call method (because super.call would refer to the base class method of that name).
But I find I really don't care. The only place where that would really matter IMO is if you want to find out if a 'super' instance is callable. Calling a base class call method would not be ambiguous - the following two classes would work the same:
class A(object):
def __call__(self, *p, **kw):
return super.__call__(*p, **kw)
class A(object):
def __call__(self, *p, **kw):
return super(*p, **kw)
So, I guess my question is whether the most common case of calling the base class method with the same name is worth having some further syntactic sugar to avoid repetition? I think it is, but that would be your call Guido.
Cheers,
Tim Delaney
- Previous message: [Python-3000] [Python-Dev] Pre-pre PEP for 'super' keyword
- Next message: [Python-3000] [Python-Dev] Pre-pre PEP for 'super' keyword
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]