strings in the global section

Bjoern Schliessmann usenet-mail-0306.20.chr0n0ss at
Thu Oct 12 19:46:36 CEST 2006

Phoe6 wrote:

> But it is not so. It always prints This is a String. astring
> declared outside all the functions, is not in global section and
> values be overwritten by functions accessing it?
> - How is this working?

If you assign "astring" inside the function body, it's a local name. 

> - What should I do to overwrite the string variable in the global
> section within functions?

Put a "global astring" in the function to access the global name

BTW, think about using a better interface than globals.



BOFH excuse #23:

improperly oriented keyboard

More information about the Python-list mailing list