two ways:
t=(1,2,3)
newt=tuple(map(lambda x: x*0.5, t))
Note: apparently the map function is slated for deprication
(to be replaced by list comprehension)
List comprehension:
t=(1,2,3)
newt=tuple([x*0.5 for x in t])
-Larry Bates
-----------------------------------------------------------
"Jay Davis" <dj********@yahoo.com> wrote in message
news:1d**************************@posting.google.c om...
I often need to multiply a tuple by a
constant and the methods I use now are
not very pretty. The idea is to get a
new tuple that is some factor times the
start tuple, like 'newtup = .5 * oldtup'.
Is there a slick way to do this?