Global Variables

George Sakkis gsakkis at rutgers.edu
Wed Apr 13 02:02:26 EDT 2005


Use 'global':

def change_filename():
   global filename
   filename=raw_input()


def change_path():
   global path
   path=raw_input()


Even better, don't use globals at all; in 99% if the time, there are
better ways to achieve the same effect.

George




More information about the Python-list mailing list