Re: User-defined augmented assignment

2005-10-01 Thread Tom Anderson
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 with 'X' begin one of the operators. That seems quite an odd move. Your proposal would lead to even more surprising behaviour; consider this: a = [1, 2

User-defined augmented assignment

2005-09-29 Thread Pierre Barbier de Reuille
] Then, in the standard library, there is no use-case of user-defined augmented assignment I could find. Of course, I find the augmented assignement itself very useful ! I use it a lot with immutable objects (strings, numbers, tuples, ...) but I tend to avoid it with mutables, and so it seems in the standard

Re: User-defined augmented assignment

2005-09-29 Thread Reinhold Birkenfeld
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 mutable objects like sets or lists. A new object

Re: User-defined augmented assignment

2005-09-29 Thread Pierre Barbier de Reuille
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 the operators. It can be done, but it's unnecessary for mutable objects

Re: User-defined augmented assignment

2005-09-29 Thread Paddy
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.