|
From: Andre W. <wo...@us...> - 2004-07-30 10:04:10
|
Hi, On 29.07.04, Magnus Lie Hetland wrote: > > I'm not totally convinced, but I might need to think a bit. But I > > can't resist to answer right now (also I may change my mind after some > > thoughts): A point having two variables is a 2d-object, a point with 3 > > variables is a 3d-object. And each position as a special meaning (i.e. > > x, y, z). So here we have a tuple, not a list. > > Same thing, IMO. I think tuples in Python are really worthless in most > cases. The only thing they'd buy us here would be immutability. (One > could argue that that would be a good thing here, in accordance with > the Value pattern.) > > But that doesn't really matter, IMO. Whether you do > > 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. A tuple is something, where the items do have a fixed, specific position and the meaning of the items might be different depending on their position. Hence a crucial feature of tuples is to be immutable in their length. Well, they are immutable in their values as well, but this keeps to be strange to me. It's kind of unpythonic ... well. I don't know. Vectors, where each component is a value for a certain dimension is not a very good example for that discussion, I think. At least when all dimensions are equal to each other like in an Euclid space. May be the theory of relativity with its four component vectors is a resonable example even for a vector being a tuple, not a list ... Beside that, you're right. We should forget about type checking and than it usually becomes unimportant. > The real difference is between this > and > > point(1, 2, 3) > > Even the numarray arrays use the first form, as do, really, all > sequence types, including tuples. In my redesign I'm only left with a single vector class. Here I'm using the list like version to create a constant and a plain number to specify a variable vectors dimension. I'm not sure whether you'll like this syntax in the end, but the user is left with just a scalar and a vector. Period. That's nice, I think, but we can discuss those details and the naming again once we see how it works out. > I'm just saying that the "standard" constructor for sequence > types admits a single iterable objects as its argument. BTW: How invented this stange *single* iterable object. I would really like to be allowed to use several of them. This limitation is annoying and unnecessary to me. (I haven't thought very hard about that, but I really don't see any reasoning why this limitation exist.) André -- by _ _ _ Dr. André Wobst / \ \ / ) wo...@us..., http://www.wobsta.de/ / _ \ \/\/ / PyX - High quality PostScript figures with Python & TeX (_/ \_)_/\_/ visit http://pyx.sourceforge.net/ |