here are two additional function-related gotchas--mostly reviewsbut common enough to reiterate enclosing scopes and loop variablesfactory functions we described this gotcha in ' discussion of enclosing function scopesbut as reminderwhen coding factory functions ( closures)be careful about relying on enclosing function scope lookup for variables that are changed by enclosing loops --when generated function is later calledall such references will remember the value of the last loop iteration in the enclosing function' scope in this caseyou must use defaults to save loop variable values instead of relying on automatic lookup in enclosing scopes see "loop variables may require defaultsnot scopeson page in for more details on this topic hiding built-ins by assignmentshadowing also in we saw how it' possible to reassign built-in names in closer local or global scopethe reassignment effectively hides and replaces that built-in' name for the remainder of the scope where the assignment occurs this means you won' be able to use the original built-in value for the name as long as you don' need the built-in value of the name you're assigningthis isn' an issue--many names are built inand they may be freely reused howeverif you reassign built-in name your code relies onyou may have problems so either don' do thator use tools like pychecker that can warn you if you do the good news is that the built-ins you commonly use will soon become second natureand python' error trapping will alert you early in testing if your built-in name is not what you think it is summary this rounded out our look at functions and built-in iteration tools with larger case study that measured the performance of iteration alternatives and pythonsand closed with review of common function-related mistakes to help you avoid pitfalls the iteration story has one last sequel in part viwhere we'll learn how to code userdefined iterable objects that generate values with classes and __iter__in ' operator overloading coverage this concludes the functions part of this book in the next partwe will expand on what we already know about modules--files of tools that form the topmost organizational unit in pythonand the structure in which our functions always live after thatwe will explore classestools that are largely packages of functions with special first arguments as we'll seeuser-defined classes can implement objects that tap into the iteration protocoljust like the generators and iterables we met here in facteverything we have summary