Roy Smith <r...@panix.com> writes: >> In general, you should avoid non-idempotent code. > I don't understand your aversion to non-idempotent code as a general > rule. Most code is non-idempotent. Surely you're not saying we > should never write: >>>> foo += 1 > or >>>> my_list.pop() > ???
I don't think "in general avoid" means the same thing as "never write". One of the tenets of the functional-programming movement is that it is in fact reasonable to write in a style that avoids "foo += 1" and "my_list.pop()" most of the time, leading to cleaner, more reliable code. In Python it's not possible to get rid of ALL of the data mutation without horrendous contortions, but it's pretty easy (and IMHO of worthwhile benefit) to avoid quite a lot of it. -- http://mail.python.org/mailman/listinfo/python-list