scopes of local and global variable
Pyenos
pyenos at pyenos.org
Fri Dec 22 20:23:28 EST 2006
More information about the Python-list mailing list
Fri Dec 22 20:23:28 EST 2006
- Previous message (by thread): scopes of local and global variable
- Next message (by thread): scopes of local and global variable
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Max Wilson" <wilson.max at gmail.com> writes: > Pyenos wrote: > > does class WORK inherit t_len=0 from line1? > > > > does def getwork() inherit t_len=0 from line1? > > > > does def formattable(table_to_process,type) inherit t_len=0 from line1? > > > > does def format_t() inherit t_len=0 from line1? > > Not really, no. The global t_len is different than the local t_len--two > variables with the same name. You need to declare "global t_len" inside > your function so it knows that "t_len=..." is assigning to the old, > global variable instead of creating a new one. > > See #6 here: http://zephyrfalcon.org/labs/python_pitfalls.html > > -Max so, based on your advice, i think the answers are all no.
- Previous message (by thread): scopes of local and global variable
- Next message (by thread): scopes of local and global variable
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list