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

Duncan Booth duncan.booth at invalid.invalid
Tue Feb 17 17:27:11 CET 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