On Thu, 21 Mar 2013 08:35:26 -0400, Colin J. Williams wrote:
> On 21/03/2013 12:27 AM, Nobody wrote:
>> On Wed, 20 Mar 2013 07:17:08 -0700, bartolome.sintes wrote:
>>
>>> I thought that x += ... was the same than x = x + ..., but today I
>>> have realized it is not true when operating with mutable
On 21/03/2013 12:27 AM, Nobody wrote:
On Wed, 20 Mar 2013 07:17:08 -0700, bartolome.sintes wrote:
I thought that x += ... was the same than x = x + ..., but today I have
realized it is not true when operating with mutable objects.
It may or may not be the same. x += y will invoke x.__iadd__(y
On Wed, 20 Mar 2013 07:17:08 -0700, bartolome.sintes wrote:
> I thought that x += ... was the same than x = x + ..., but today I have
> realized it is not true when operating with mutable objects.
It may or may not be the same. x += y will invoke x.__iadd__(y) if x has
an __iadd__ method, otherwi
bartolome.sin...@gmail.com writes:
> Hi,
>
> I thought that x += ... was the same than x = x + ..., but today I
> have realized it is not true when operating with mutable objects.
>
> In Python 3.3 or 2.7 IDLE (Windows) compare:
> >>> a = [3]
> >>> b = a
> >>> a = a + [1]
> >>> b
> [3]
>
> and
Hi,
I thought that x += ... was the same than x = x + ..., but today I have
realized it is not true when operating with mutable objects.
In Python 3.3 or 2.7 IDLE (Windows) compare:
>>> a = [3]
>>> b = a
>>> a = a + [1]
>>> b
[3]
and
>>> a = [3]
>>> b = a
>>> a += [1]
>>> b
[3, 1]
Is this beha