[Python-ideas] Optimizing builtins

Guido van Rossum guido at python.org
Mon Jan 3 19:09:07 CET 2011


On Mon, Jan 3, 2011 at 6:33 AM, Michael Foord <fuzzyman at voidspace.org.uk> wrote:
> A few years ago I worked for a company where most of the (very talented)
> developers were new to Python. They called me over to explain what
> "UnboundLocalError" meant and why they were getting it in what looked (to
> them) like perfectly valid code. The code looked something like:
>
> def something(start, stop):
>    positions = range(start, stop)
>
>    # more code here...
>
>    range = process(positions)

Yeah, and the really annoying thing for us old-timers is that this
used to work (in Python 1.0 or so :-). Once upon a time, looking up
locals was as dynamic as looking up globals and builtins is today.
Still, I think for optimizing builtins we can do slightly better.

-- 
--Guido van Rossum (python.org/~guido)



More information about the Python-ideas mailing list