On 30/11/2007, Barry Warsaw <[EMAIL PROTECTED]> wrote: > >> class Example: > >> implements(IExample) > > This frame hacking is also a pretty common feature of other types of > systems, such as ORMs. It can make certain Python code much more > readable, so "frame hacking" is clearly a useful feature, at least it > seems, in the context of a class definition. Is there a way to > promote this to an API that's more principled than the sys._getframe > () hack, and thus more acceptable to Guido and more portable to other > implementations? > > (Or is something like this already in Py3K, and I just haven't > noticed it yet? ;).
There's class decorators: @implements(IExample) class Example: pass which could provide the same result in effect, but (as J-P points out) it's still an API change and so not a direct replacement. IIRC, one of the arguments for class decorators was that they are a way to avoid the need for some of this getframe hacking, though. Paul. _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com