Death to tuples!

Alex Martelli aleax at mail.comcast.net
Mon Nov 28 22:30:40 EST 2005


<skip at pobox.com> wrote:
   ...
> Actually, no, I hadn't.  I don't use tuples that way.  It's rare when I have
> a tuple whose elements are not all floats, strings or ints, and I never put
> mutable containers in them.

You never have a dict whose values are lists?  Or never call .items (or
.iteritems, or popitem, ...) on that dict?  I happen to use dicts with
list values often, and sometimes use the mentioned methods on them...
and said methods will then return one or more tuples "with a mutable
container in them".  I've also been known to pass lists as arguments to
functions (if the functions receives arguments with *args, there you are
again: args is a then tuple with mutable containers in it), use
statements such as:
    return 1, 2, [x+1 for x in wah]
which also build such tuples, and so on, and so forth... tuples get
created pretty freely in many cases, after all.


Alex
 



More information about the Python-list mailing list