a question about decorator

Bruno Desthuilliers bruno.42.desthuilliers at wtf.websiteburo.oops.com
Mon Oct 22 08:07:52 EDT 2007


Trent Nelson a écrit :
(snip (rather convoluted) decorator example)

> When Python first parses your code, every time it runs into '@A', it
> calls A() in order to get the required decorator function.

It's not happening at parsing time, but when the (decorated) def 
statement is executed - that is, *usually* (but not necessarily), when 
the module/script is loaded in the interpreter (either as a the main 
program or thru import).




More information about the Python-list mailing list