Introducing Python to others
Mensanator
mensanator at aol.com
Thu Mar 26 19:19:19 EDT 2009
On Mar 26, 4:32 pm, Jervis Whitley <jervi... at gmail.com> wrote:
> >>>>>> class Vector(list):
>
> >>> ... def __add__(self, other):
> >>> ... return map(add, self, other)
> >>> ...>>> x = Vector([1,2])
>
> I've used the complex type for a similar problem (2D Cartesian points)
> in the past, I saw the suggestion
> once on the pygame list.
>
> >>> x = complex(1,2)
> >>> x + x
> (2 + 4j)
But those are floats aren't they?
Don't games use stuff like pixels per parsec? :-)
>
> Cheers,
>
> Jervis
More information about the Python-list
mailing list