Ken> We haven't even seen a satisfactory approach to referring to the Ken> function, itself, from within the function. Maybe it's not even Ken> desirable to be able to do that - that's an interesting question. I hereby propose that within a function the special name __ refer to the function. You could have def fact(n): if n <= 1: return 1 return __(n-1) * n You could also refer to function attributes through __ (presuming Barry's proposed patch gets adopted): def pub(*args): if __.access == "private": do_private_stuff(*args) else: do_public_stuff(*args) ... if validate_permissions(): pub.access = "private" else: pub.access = "public" When in a bound method, __ should refer to the bound method, not the unbound method, which is already accessible via the class name. As far as lexical scopes are concerned, this won't change anything. I think it could be implemented by adding a reference to the function called __ in the local vars of each function. -- Skip Montanaro | http://www.mojam.com/ skip@mojam.com | http://www.musi-cal.com/
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