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
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4