On Aug 16, 2011, at 11:12 AM, Chris Angelico wrote: > On Tue, Aug 16, 2011 at 3:13 PM, Philip Semanchuk <phi...@semanchuk.com> > wrote: > >> One need look no further than the standard library to see a strong >> counterexample. grep through the Python source for " file =". I see dozens >> of examples of this builtin being used as a common variable name. I would >> call contributors to the standard library above-average coders, and we can >> see them unintentionally shadowing builtins many times. >> > > There are several types of shadowing: > > 1) Deliberate shadowing because you want to change the behavior of the > name. Extremely rare. > 2) Shadowing simply by using the name of an unusual builtin (like > 'file') in a context where you never use it. Very common. > 3) Unintentional shadowing where you create a variable, but then > intend to use the builtin. This is the only one that's a problem.
Yes, but before you get to #3 you have to go through #2. The way I see it, #2 is setting a trap, #3 is actually stepping in it. I don't want to do either. Neither do I like working with code that has set trap #2 for me. Cheers Philip -- http://mail.python.org/mailman/listinfo/python-list