|
From: Magnus L. H. <ma...@he...> - 2004-07-29 11:47:23
|
Andre Wobst <wo...@us...>: > [snip] >=20 > 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 ;). 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. > (There *are* cases, where we have tuples, not lists.) As I said, there's really no practical difference, IMO. > In that sense I think its different from the attribute discussion > ... Sure. I'm just saying that the "standard" constructor for sequence types admits a single iterable objects as its argument. And if one stays away from type checking, one could even use future enhancements, such as the upcoming generator comprehensions, such as: b =3D point(x**2 for x in a) :) You *could*, of course, still do b =3D point(*[x**2 for x in a]) of course... > Andr=E9 --=20 Magnus Lie Hetland "Canned Bread: The greatest thing since sliced http://hetland.org bread!" [from a can in Spongebob Squarepants] |