Augmented Assignement (was: Re: PEP scepticism)

Paul Prescod paulp at ActiveState.com
Thu Jun 28 14:32:34 EDT 2001


I think Python has been getting better and better as time goes on. But I
do have a concern about augmented assignment. How can a newbie
understand that tuples are "immutable" if this works:

mytuple += (foo,bar)

Worse, once they've learned that this does NOT affect other references
to mytuple they are bound to be confused by

mylist += [foo, bar]

which does!

I've seen this confusion already -- in a draft of a book no less.
-- 
Take a recipe. Leave a recipe.  
Python Cookbook!  http://www.ActiveState.com/pythoncookbook




More information about the Python-list mailing list