PyWart: Namespace asinitiy and the folly of the global statement

Steven D'Aprano steve+comp.lang.python at
Fri Feb 8 12:29:30 CET 2013

Chris Angelico wrote:

> On Fri, Feb 8, 2013 at 3:30 PM, Rick Johnson
> <rantingrickjohnson at> 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))

Pardon me, but since __builtins__ is a global, you have to say:

globals.__builtins__.print("screw this for a game of soldiers")

or equivalent.


More information about the Python-list mailing list