y confusing, as the two "a" are not necessarily the
> same.
Indeed. I certainly didn't realise that was how it worked.
> So, what I would suggest is to drop the user-defined augmented
> assignment and to ensure this equivalence :
>
> a X= b <=> a = a X b
>
I thought along these lines:
It is an augmented ASSIGNMENT. (It even has an equals sign in it).
tuples are immutable so you should not be able to assign to one of
its elements.
- So there is no problem for me - I shouldn't be messing with an
element of an
immutable type!
- Cheers, Paddy.
--
Reinhold Birkenfeld a écrit :
> Pierre Barbier de Reuille wrote:
>
>
>>So, what I would suggest is to drop the user-defined augmented
>>assignment and to ensure this equivalence :
>>
>>a X= b <=> a = a X b
>>
>>with 'X' begin one of th
Pierre Barbier de Reuille wrote:
> So, what I would suggest is to drop the user-defined augmented
> assignment and to ensure this equivalence :
>
> a X= b <=> a = a X b
>
> with 'X' begin one of the operators.
It can be done, but it's unnecessary for mu
b[0] += [2] # Ok, no pb
>>> print a
[1,2]
>>> c[0] += [3]
Traceback (most recent call last):
File "", line 1, in ?
TypeError: object doesn't support item assignment
>>> print a
[1,2,3]
Then, in the standard library, there is no use-case of user-defined