strings in the global section
usenet-mail-0306.20.chr0n0ss at spamgourmet.com
Thu Oct 12 19:46:36 CEST 2006
> 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