>>>>>> 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)

Cheers,

Jervis
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to