On Tue, 04 Oct 2011 20:20:34 -0700, alex23 wrote: > Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> wrote: >> Imported modules are variables like any other, and as they usually >> exist in the global scope, so they will all need to be explicitly >> referenced as global. This will get tiresome very quickly, and is a >> cure far worse than the disease, and alone is enough to disqualify this >> suggestion from serious consideration. > > But on the gripping hand, it is a clear triumph of "Explicit is better > than implicit." ;)
I see your wink, but explicitness is not a binary state. You can have too much explicitness. Which would you rather? import math x = math.sin(1.2345) or: import the module called 'math' into the current namespace and bind that module to the name 'math' in the current namespace bind the name 'x' in the current namespace to the return result of calling the attribute named 'sin' in the object currently bound to the name 'math' in the current namespace using the float literal 1.2345 as the argument I'm thinking that the second version might get a bit annoying after a little while, no matter what the Zen says. Besides, based on the Zen, should we also write this? local.x = global.math.sin(1.2345) -- Steven -- http://mail.python.org/mailman/listinfo/python-list