non-implicit globals -- missing feature

Helmut Jarausch jarausch at
Mon Jun 16 22:06:40 CEST 2003


I'm missing a feature (in many programming languages including
Python) that does not use global variables unless requested.

Is there any means in Python to catch errors like this following one?


# many many lines here

def mysub()
   # x=7   #forgot this assignment
   # ....
   anothersub(x)  # this uses the global x unfortunately
                  # how can I get an exception here ?

So I would prefer if there were an option / pragma
which say  # __no_implicit_globals__

Is there any way to get this behaviour?

Thanks for a comment

Helmut Jarausch

Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany

More information about the Python-list mailing list