[Python-ideas] And now for something completely different

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Sep 18 07:28:07 CEST 2008

Cliff Wells wrote:
> It would
> be evaluated as if it were evaluated at the time of the function call.
> This may be a serious implementation problem, but I'll let the experts
> answer that.

Unless some clever implementation trick could be found, this
would have extremely serious performance implications in

Every expression used as a function argument would have
to be compiled as a separate function. A closure would
need to be created every time it was used, and a Python
call executed every time it was evaluated, both fairly
expensive operations. Any variables it uses from the
surrounding scope would need to be allocated in cells,
meaning more memory allocations and access overhead.

I could imagine this making the execution of *all* Python
code several times slower or worse.


More information about the Python-ideas mailing list