degrees and radians.

Andrae Muys amuys at shortech.com.au
Tue May 7 20:46:39 EDT 2002


Jim Richardson <warlock at eskimo.com> wrote in message news:<oj04ba.tnb.ln at 127.0.0.1>...
> sorry, I wasn't very clear, in the above example, the result I am
> looking for is
> 
> >>>a=(1,2)
> >>>b=(2,3)
> >>>a+b
> (3,5)
> 

Well if it's just a one-off you can use a simple list comprehension

[a+b for a,b in zip(a,b)]
[3,5]

if you specifically need a tuple then wrapping the above in tuple()
will do the conversion.

However if this is likely to be a common task (as I suspect), then you
are better off using Numeric as suggested, or (less likely) rolling
your own class.

Andrae Muys



More information about the Python-list mailing list