[Python-ideas] And now for something completely different

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Sep 19 03:14:56 CEST 2008


Cliff Wells wrote:

> I think the overhead of creating a closure would
> be acceptable provided it only affected this explicitly specified case
> and not function calls in general.

The problem is telling which cases are affected. If you can't
tell until run time, then code has to be generated to handle
either possible case for all function arguments, which seems
like an effort out of proportion to the problem being solved.
And there will still be some runtime overhead in selecting
between the two cases.

The only way I could see this working is if deferred arguments
are marked at *both* the calling and called sites. Then the
compiler knows what code to generate, and the called function
can check that it has been passed the right kind of argument.

-- 
Greg



More information about the Python-ideas mailing list