[Python-Dev] Dropping decorator syntax for 2.4?
Thomas Heller
theller at python.net
Fri Jun 4 05:59:46 EDT 2004
Couldn't Guido's syntax be implemented as a combination of an import
hook together with a byte code hack, without direct support in the core?
Code like this
[decorator1, decorator2]
def func(args):
pass
seems to be compiled into these byte codes
....
6 BUILD_LIST
9 POP_TOP
10 LOAD_CONST 0 (<code object test at 0091FD20, ...)
13 MAKE_FUNCTION 0
16 STORE_NAME 2 (test)
It seems BUILD_LIST / POP_TOP / LOAD_CONST / MAKE_FUNCTION is the
sequence which should trigger the magic.
Thomas
More information about the Python-Dev
mailing list