Raymond Hettinger <[email protected]> added the comment:
FWIW, the usual approach to the OP's problem is:
>>> [x*0.5 for x in range(10)]
[0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5]
This technique generalizes to other sequences as well:
>>> [x**2 for x in range(10)]
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
As Steven points out, numeric work typically requires something different and a
bit more sophisticated. The numpy package may be your best bet for this kind
of work.
----------
nosy: +rhettinger
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue41719>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com