On Fri, Feb 8, 2013 at 3:30 PM, Rick Johnson
<[email protected]> wrote:
> It is my strong opinion that all "unqualified" variables must be local to the
> containing block, func/meth, class, or module. To access any variable outside
> of the local scope a programmer MUST qualify that variable with the func,
> class, or module identifiers. Consider the following examples
Okay. Now start actually working with things, instead of just making
toys. All your builtins now need to be qualified:
__builtins__.print("There
are",__builtins__.len(self.some_list),"members in this list,
namely:",__builtins__.repr(self.some_list))
And your imports happen at module level, so they need extra qualification:
# file: example.py
import sys
def foo():
__builtins__.print("My args were:",example.sys.argv)
Actually, you already ran up against this. Your example needs to become:
for x in __builtins__.range(100):
# Increment the module level variable count.
example.count += 1
Or are you going to make builtins and imports magically available as
PHP-style superglobals?
ChrisA
--
http://mail.python.org/mailman/listinfo/python-list