Is this a bug?
Grant Edwards
grante at visi.com
Mon Apr 25 00:03:24 EDT 2005
On 2005-04-25, Robert Kern <rkern at ucsd.edu> wrote:
>> I certainly don't see how. Strings are immutable. The old
>> object can't be modified in-place, so the "in-place" behavior
>> is moot.
>
> It's the left-hand-side, in this case a list, that gets modified
> in-place. Whether the right-hand-side is mutable or not is irrelevant.
You're right. I had things backwards in my head.
>> Your quote states quite clearly that the binary operation *is
>> the same* whether it's spelt a = a + b or a += b. That is
>> simply not true for the example we're discussing.
>
> No, the quote says "with the exception of the possible
> in-place behavior, the binary operation performed by augmented
> assignment is the same as the normal binary operations." This
> is "in-place" behavior. Badly designed "in-place" behavior,
> yes.
Right. The binary operation performed should be the same
regardless of whether it is done in place or not. In this
case, the "in-place" behavior is completely different than the
other spelling.
> It's a mistake, but it's been in the wild too long to be changed. Thus,
> it should be documented.
Life's like that, unfortunately.
--
Grant Edwards grante Yow! I'm RELIGIOUS!! I
at love a man with a
visi.com HAIRPIECE!! Equip me with
MISSILES!!
More information about the Python-list
mailing list