On 01/12/2013 09:14, Dominik George wrote:
Hi,
- Do not create a list of the floating point values as i=[0.01, 0.02,
0.03..] - either like that or by using a suitable mathematical formula
combined with a list comprehension
You could simply write your own version of xrange that does it, as a
generator:
def xrange_f(start, stop, step):
x = start
while x < stop:
yield x
x += step
Then, in your code, you can do:
for f in xrange_f(0, 10, 0.01):
pass
-nik
To encourage Python 3 take up this should be range rather than xrange :)
--
Python is the second best programming language in the world.
But the best has yet to be invented. Christian Tismer
Mark Lawrence
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor