Gerhard Fiedler a écrit : > On 2006-07-25 13:33:40, Dennis Lee Bieber wrote: > > >>>Surprising for me are actually two things: 1- the fact itself, and 2- that >>>term "binding", and that whatever it means (I'll have to read more on that, >>>now that I know the term) is different for read-only and read/write access. >>> >> >>Binding only happens when the bare name is on the LHS of an assignment >>(or, to complicate matters, passed as an argument). > > This makes a lot more sense now. > >>Binding has nothing to do with "read-only" vs "read/write" access. > > > Isn't being on the LHS the only way to write to a non-mutable object?
You *don't* "write to a non-mutable object". You rebind the name to another object (mutable or not, that's not the problem). >Are > there situations where binding happens without writing to a variable? binding and "assignment" (what you call "writing to a variable") are the very same operation. > Are > there write accesses to non-mutable objects No. > where the name is not on the > LHS? Doesn't matter when it comes to immutable objects. As the name imply, you cannot modify an immutable object once it's created. Rebiding a name bound to an immutable object doesn't impact the object[1], it just makes the name refers to another object. [1] or, to be more exact, it only decreases the object's reference count, which can lead to the object being disposed of... -- http://mail.python.org/mailman/listinfo/python-list