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

-- 
* concerning Mozilla code leaking assertion failures to tty without D-BUS *
<mirabilos> That means, D-BUS is a tool that makes software look better
            than it actually is.

PGP-Fingerprint: 3C9D 54A4 7575 C026 FB17  FD26 B79A 3C16 A0C4 F296

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to