On Sun, 16 Apr 2000, Skip Montanaro wrote: > > 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): At first i thought you were kidding about using '__' because '_' was taken - on lots of terminals that i use, there is no intervening whitespace separating the two '_'s, so it's pretty hard to tell the difference between it and '_'! Now, i wouldn't mind using '_' if it's available, but guido was pretty darned against using it in my initial designs for packages - i wanted to use it to refer to the package containing the current module, like unix '..'. I gathered that a serious part of the objection was in using a character to denote non-operation syntax - python just doesn't do that. I also like the idea of using a function instead of a magic variable - most of python's magic variables are in packages, like os.environ. Ken klm@digicool.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