Code evaluation at function definition execution time (was Re: Compile time evaluation (aka eliminating default argument hacks))

Nick Coghlan ncoghlan at iinet.net.au
Sat Feb 26 02:00:24 EST 2005


Steven Bethard wrote:
> Worth looking at is the thread:
> 
> http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/58f53fe8bcc49664/ 

Huh - I thought I put something in the original post saying "without resorting 
to bytecode hacks", but I must have deleted it before sending the message.

Anyway, that thread is what the comment about bytecode hacks would have been 
referring to :)

Although, once the AST compiler goes in, if the AST for a function is attached 
via a special attribute like __ast__, then perhaps such manipulations could be 
rewritten to work on the AST instead of the bytecode. If that happens, they 
might become less hackish.

So I guess I should wait and see what the next few months holds in terms of 
AST-hacks :)

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at email.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://boredomandlaziness.skystorm.net



More information about the Python-list mailing list