User-defined augmented assignment

Reinhold Birkenfeld reinhold-birkenfeld-nospam at wolke7.net
Thu Sep 29 09:45:16 EDT 2005


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 must be created in these cases where
one would suffice.

Reinhold



More information about the Python-list mailing list