Another possible solution would be to use numpy
which would be very efficient, for large lists perhaps even more efficient than a list comprehension or a for loop.
import numpy as np
a = np.arange(5.0) # a --> array([0., 1., 2., 3., 4.])
# numpy operates on arrays element by element
#
b =3.*a # b --> array([0., 3., 6., 9., 12.])
This is a pretty simple operation but you can get more complex using an array as simply an argument in a formula. For large arrays this can be much faster than a list comprehension and it makes the code cleaner and easier to read (no need to create a function to map in a list comprehension). You can also use indexing and slicing to tailor what you want to do:
If you want to have access to the actual index positions use ndenumerate
# b is as above
for i, x in np.ndenumerate(b):
print i, x
The output of this for loop is:
(0,) 0.0
(1,) 3.0
(2,) 6.0
(3,) 9.0
(4,) 12.0
NOTE: the index returned as a tuple by numpy to handle additional dimensions. Here we only have a single dimension so you'd have to unpack the tuple to get the index of the element.