> guido wrote: > > > > class MyClass (BaseClass): > > > def foo (self, arg1, arg2): > > > super.foo(arg1, arg2) > > > > I'm sure that's everybody's favorite way to spell it! > > not mine. my brain contains far too much Python 1.5.2 code > for it to accept that some variables are dynamically scoped, > while others are lexically scoped. > > why not spell it out: > > self.__super__.foo(arg1, arg2) > > or > > self.super.foo(arg1, arg2) > > or > > super(self).foo(arg1, arg2) > > > Or, to relieve the burden from the symbol table, we could make super > > a keyword, at the cost of breaking existing code. > > hey, how about introducing $ as a keyword prefix for newly introduced > keywords? > > $super.foo(arg1, arg2) > > (this can of course be mapped to either of my previous suggestions; > "$foo" either means "self.foo" or "foo(self)"...) > > and to save a little typing, only use it for keywords that start with > an "s" (should leave us plenty of expansion room): > > $uper.foo(arg1, arg2) > > otoh, if "super" is common enough to motivate introducing magic objects > into python, maybe "$" should mean "super."? > > $foo(arg1, arg2) > > and while we're at it, let's introduce "@" for "self.". > > gotta run -- time for my monthly reboot /F LOL! But you forgot the spelling of self.__super.foo(arg1, arg2) which would pass in the class name that's the other necessary input to a proper implementation of super. :-) --Guido van Rossum (home page: http://www.python.org/~guido/)
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