setting variables in the local namespace

Duncan Booth duncan.booth at invalid.invalid
Tue Oct 13 13:02:39 EDT 2009


Chris Withers <chris at simplistix.co.uk> wrote:

> Now, if I want to do *exactly* the same thing with a variable named 
> 'sort', I have to copy and paste the above code or do something hacky 
> like have a dict called "vars" and manipulate that, or factor the above 
> into a function and take the hit on the extra function call...
> 
The function call every time. You aren't going to notice the extra function 
call.

Once you've got everything working, and you've profiled it, and you've 
determined that that function call is a major overhead, then might be the 
time to consider optimising it, but not before then.



More information about the Python-list mailing list