what do people use for 2D coordinates?

Andy C aayycc88 at hotmail.com
Fri Aug 1 19:37:38 EDT 2003


You could use tuples or complex numbers (seems like a bit of a hack). 
I saw somewhere it said that tuples are useful for coordinates.  But I
haven't found a nice way to add coordinates, since + does
concatenation on tuples.

Is there a better way than to keep writing (a[0]+b[0], a[1]+b[1])
instead of just a+b?  (and 2*a instead of (2*a[0], 2*a[1]) ). I know
there is this NumPy library, but that seems like overkill for what I
need.  I'm just doing some simple 2D drawing.  I know it would be
trivial to write my own Point class, but I'm just wondering what other
people do.  It would be nice if there was some built in module that
does basic vector math.




More information about the Python-list mailing list