Changing global variables in tkinter/pmw callback
Fredrik Lundh
fredrik at pythonware.com
Fri Apr 6 03:28:45 EDT 2001
Brian Elmegaard wrote:
> > (when you type "s[0] = 10", you ask whatever "s" points to
> > to replace item zero with a new value. in your case, you ask
> > the list "s" to modify it's first item. anyone else referring to
> > the same list object will see this change)
>
> And someone are. Could the same be done with the 10 in s=10?
hint: do integer objects have any methods that you can
use to modify their content?
>>> s = 10
>>> dir(s)
[]
>>> a[0] = 1
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: object does not support item assignment
>>> s.a = 1
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: attribute-less object
>>> s()
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: call of non-function
Cheers /F
More information about the Python-list
mailing list