The global statement

David Hitillambeau edavid at intnet.mu
Wed Jul 23 16:53:59 CEST 2003


Hi guys,
As I am new to Python, i was wondering how to declare and use global
variables. Suppose i have the following structure in the same module (same
file):

def foo:
  <instructions>
  <instructions>
def bar:
  <instructions>
  <instructions>

I want to enable some sharing between the two functions (foo and bar)
using one global variable in such a way that each function can have read
and write access over it.

How can i manage this please?

I've read about "The global statement" in python's documentation and still
can't figure out it's use.

Thanks.
--
David.H




More information about the Python-list mailing list