[Python-Dev] Explicit Lexical Scoping (pre-PEP?) (original) (raw)
Ka-Ping Yee python-dev at zesty.ca
Thu Jul 13 00:38:44 CEST 2006
- Previous message: [Python-Dev] Explicit Lexical Scoping (pre-PEP?)
- Next message: [Python-Dev] Explicit Lexical Scoping (pre-PEP?)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, 13 Jul 2006, Fredrik Lundh wrote:
Boris Borcic wrote:
>> note that most examples of this type already work, if the target type is >> mutable, and implement the right operations: >> >> def counter(num): >> num = mutableint(num) >> def inc(): >> num += 1 >> return num >> return inc [...] feel free to replace that += with an .add(1) method call; the point wasn't the behaviour of augmented assigment, the point was that that the most common use pattern involves mutation of the target object.
I don't think that's clear. In:
a = 1
b = a
a += 1
it doesn't seem common to me that one would expect b to become 2. Sometimes you want mutation, sometimes you don't. I don't think that necessarily follows from whether you are accessing a free variable.
-- ?!ng
- Previous message: [Python-Dev] Explicit Lexical Scoping (pre-PEP?)
- Next message: [Python-Dev] Explicit Lexical Scoping (pre-PEP?)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]