Why read-only nested scopes?
Andrew Koenig
ark at research.att.com
Wed Sep 4 15:46:49 EDT 2002
Gonçalo> Anyway, I've been directed to PEP 227, cheerfully obeyed, and
Gonçalo> from what I have understood having read-only nested scopes
Gonçalo> was more of a design decision than something else. And while
Gonçalo> I can live happily with the decision (some would even say
Gonçalo> happier) there is something about the "You can look at it but
Gonçalo> not touch it" attitude that I dislike ;-)
You can do anything to the object that the object support.
What you can't do is change the binding of the name.
x = []
def foo(y):
x.append(y);
foo(3)
foo(4)
foo(5)
After executing this code, x is [3, 4, 5].
--
Andrew Koenig, ark at research.att.com, http://www.research.att.com/info/ark
More information about the Python-list
mailing list