On Wed, Mar 31, 2004 at 07:16:06PM -0500, Phillip J. Eby wrote: > It sounds like a lot of people's "use" translates to your "abuse"; > e.g. Bob's use cases would certainly have to be considered abuse, > since they wouldn't be part of some fixed set defined by Python. Yup. It seems to me that there are a number of different use cases and they all want to try to use the same new syntax. > [Binding _ to the last function definition] doesn't do what's > needed, since you left out the rebinding of the function name. That's possible without new syntax. Some example code: import sys def myclassmethod(func): frame = sys._getframe(1) name = func.func_name if name in frame.f_locals: namespace = frame.f_locals elif name in frame.f_globals: namespace = frame.f_globals else: raise NameError, 'cannot find %r' % name namespace[name] = classmethod(func) class A: def something(): pass myclassmethod(something) print something It's not pretty but it might prevent people from developing RSI while Guido works out what new syntax is best. > Finally, it doesn't address the issue of wanting to call these > things out *ahead* of the function's code, as part of the > definition header, so that a person who is reading for an overview > can notice it and take it in. That's true. Neil
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