How do I declare global vars or class vars in Python ?

Duncan Booth duncan.booth at invalid.invalid
Tue Feb 17 11:27:11 EST 2009


"Paddy O'Loughlin" <patrick.oloughlin at gmail.com> wrote:

> True, but you can use the global statement to refer to the variable
> within a function and read from the variable there, without it being
> already initialised in the module.

You don't need the global statement unless you plan to *write* the variable 
from the function.

-- 
Duncan Booth http://kupuguy.blogspot.com



More information about the Python-list mailing list