From: Andre Wobst <wobsta@us...>  20040801 20:29:56

Hi, On 30.07.04, Magnus Lie Hetland wrote: > [snip] > > > point([1, 2, 3]) > > > > > > or > > > > > > point((1, 2, 3)) > > > > > > is completely irrelevant (as long as you stay away from the > > > naughtiness of type checking ;). > > > > I'm not so sure. To me it makes a difference. > > Not unless you're doing type checking ;) > > I'm talking from the perspective of the function, not the caller. The > function should simply treat the argument as a sequence, and not > bother with how it is implemented. Sure, that's right. My points were not related to the isinstance discussion we actually started at. > The only use of tuples, IMO (as a Python type, not as a concept  you > could easily use a list to model a mathematical tuple, where each > position has a specific meaning and so forth) is that they are > hashable, and thus can be used as keys in dicts, members of sets and > so forth. You have the same dichotomy (list vs. tuple) in the set > implementation (with set and frozenset). I see, the hasability is an important point. I pretty much like your comparision to set and frozenset. It looks like a very reasonable point of view ... > What do you mean? Would you like to use several iterable objects as > arguments to list(), for example? What would that mean? Something like > list(chain(iter1,iter2,iter3))? (The chain function is available in > the itertools module.) I meant list(*chain(iter1, iter2, iter2)). I would really like to be able to write list(*iter1, *iter2, *iter3). Suppose we have the line function line(x1, y1, x2, y2) as it is defined in PyX. Having a function point(...) returning a list (x, y), it would be great if we could just write line(*point(...), *point(...)). Currently you have to write line(*(point() + point()), which I don't understand why ... Coming back to our MetaPost like equations I've just checked in yet another version, where there are scalars, vectors, and matrices now. You can define a matrix by equations like in MetaPost, i.e. which points should be transformed into which points (except for the missing translation; a matrix is not a full affine transformation, but building a trafo class on top of a matrix and a vector should be quite easy). You can also calculate the invers of a matrix by multiplying it to another matrix and set the result to the uniform matrix ... so in principle we should be able to do most of the things you can do in MetaPost now. One structually missing thing is the "redefinition" of an equation, but this should not be hard to add it to the solver. André  by _ _ _ Dr. André Wobst / \ \ / ) wobsta@..., http://www.wobsta.de/ / _ \ \/\/ / PyX  High quality PostScript figures with Python & TeX (_/ \_)_/\_/ visit http://pyx.sourceforge.net/ 