"Jim" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >> Tuples or lists for matrix-like functionality? > > Use lists. Tuples are meant for small immutable sets of things that go > together. Lists are more like arrays, and you can assign to one > existing element if you want. > > One exception, is a short vector is often a tuple like (x, y, z) and > you might want to multiply that vector by your matrix. You can convert > a tuple to a list with list(aTuple) or back with tuple(aList.) > > Even better, take a look at numarray (or numpy or scipy or scipy_core.) > They all have really nice matrix code and there are C APIs that let > you manipulate them. Chances are they do everything you're intending > to implement. > > Immutability example: > tup = ("a", "b", "c") > tup[1] = "g" > Traceback (most recent call last): > File "<input>", line 1, in ? > TypeError: object does not support item assignment > lst = ["a", "b", "c"] > lst[1] = "g" > lst > ['a', 'g', 'c'] > > > -Jim >
Thanks! -- http://mail.python.org/mailman/listinfo/python-list