Antoon Pardon wrote:
Op 2005-02-19, jfj schreef <[EMAIL PROTECTED]>:

once foo() returns there is no way to modify 'x'!
It becomes a kind of constant.


In this particular case yes. But not in general, what about
this:


def F():

... l = []
... def pop():
... return l.pop()
... def push(e):
... l.append(e)
... return pop, push
...



Others will point this out, but if I'm fast enough...

This does not change the object referenced by l.
It calls methods of it and because it is mutable the containts
of the list are modified.
'l' is a list at address, 0xXXXX and that can never change once
F() has returned.


jfj -- http://mail.python.org/mailman/listinfo/python-list

Reply via email to