Revised PEP 318 - Function/Method Decorator Syntax
just at xs4all.nl
Tue Jun 10 23:10:55 CEST 2003
In article <698f09f8.0306101302.688b7e52 at posting.google.com>,
tweedgeezer at hotmail.com (Jeremy Fincher) wrote:
> Bernhard Herzog <bh at intevation.de> wrote in message
> news:<6qwufu12ee.fsf at salmakis.intevation.de>...
> > *compiled*?
> > Surely you mean "when the def-statement is executed."
> > > In either case, the modified function is bound to the function
> > > name at compile time.
> > Again, I think you mean "when the def-statement is executed."
> No, he probably means "compile time." Python is compiled to bytecode
> separate from being execute, the the def statement is executed at
> compile time.
>>> for i in range(5):
... def foo(a=i):
... print a
The code is compiled once, sure, but the function object is created at
runtime (a function object is just a thin wrapper around a code object).
More information about the Python-list