In article <[EMAIL PROTECTED]>,
Roel Schroeven <[EMAIL PROTECTED]> wrote:
>
>I used to interpret the target in 'The target is only evaluated once'
>more like an L-value in C/C++. That's not correct, of course, but I
>didn't understand exactly how wrong it was until now.
It's true almost everywh
In article <[EMAIL PROTECTED]>,
OKB (not okblacke) <[EMAIL PROTECTED]> wrote:
>
> This sentence is phrased as though it is the whole story, but it
>isn't, because the operation might not in fact wind up being an
>assignment. Shouldn't there be an "except see below" or something
>there, to
OKB (not okblacke) schreef:
> Aahz wrote:
>
>>> tup=([],)
>>> tup[0] += ['zap']
Traceback (most recent call last):
File "", line 1, in
TypeError: 'tuple' object does not support item assignment
>
>> Obviously, you can easily work around it:
>>
> t = ([],)
> l = t
Aahz wrote:
>> tup=([],)
>> tup[0] += ['zap']
>>> Traceback (most recent call last):
>>> File "", line 1, in
>>> TypeError: 'tuple' object does not support item assignment
> Obviously, you can easily work around it:
>
t = ([],)
l = t[0]
l += ['foo']
t
> (['foo'],)
Aahz schreef:
def foo(bar): bar[0] += ['zap']
> ...
import dis
dis.dis(foo)
> 1 0 LOAD_FAST0 (bar)
> 3 LOAD_CONST 1 (0)
> 6 DUP_TOPX 2
> 9 BINARY_SUBSCR
> 10 LOAD_
In article <[EMAIL PROTECTED]>,
Roel Schroeven <[EMAIL PROTECTED]> wrote:
>Aahz schreef:
>>
>> Although Alex is essentially correct, the situation is a bit more complex
>> and you are correct that augmented assignment allows the object to decide
>> whether to mutate in place. However, the critic
Aahz schreef:
> In article <[EMAIL PROTECTED]>,
> Neil Cerutti <[EMAIL PROTECTED]> wrote:
>> On 2007-08-11, Alex Martelli <[EMAIL PROTECTED]> wrote:
>>> Neil Cerutti <[EMAIL PROTECTED]> wrote:
>>>...
The Python Language Reference seems a little confused about the
terminology.
>>
In article <[EMAIL PROTECTED]>,
Neil Cerutti <[EMAIL PROTECTED]> wrote:
>On 2007-08-11, Alex Martelli <[EMAIL PROTECTED]> wrote:
>> Neil Cerutti <[EMAIL PROTECTED]> wrote:
>>...
>>> The Python Language Reference seems a little confused about the
>>> terminology.
>>>
>>> 3.4.7 Emulating nume