This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author abarnert
Recipients abarnert, docs@python, rhettinger
Date 2015-01-14.06:45:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1421217955.66.0.420502294095.issue23226@psf.upfronthosting.co.za>
In-reply-to
Content
So something like the first version below? Or should even the example be inline, as in the second version below? (Apologies if the formatting gets screwed up pasting from docs to bugs.)

---

Range objects are inappropriate for non-integral types, especially inexact types such as :class:`float`.  In most cases, for such types, it is better to specify a count of numbers or intervals instead of a step size.  For example:

   >>> start, stop, num = 0, 10, 11
   >>> step = (stop-start)/(num-1)
   >>> [start + i*step for i in range(num)]
   [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0]

.. seealso::

   * `linspace recipe <http://code.activestate.com/recipes/579000/>`_
     for an example lazy sequence built on this algorithm, and links
     to alternatives.

---

Range objects are inappropriate for non-integral types, especially inexact types such as :class:`float`.  In most cases, it is better to specify a count of numbers or intervals instead of a step size, as in `[start + i*(stop-start)/(num-1) for i in range(num)]`.

.. seealso::

   * `linspace recipe <http://code.activestate.com/recipes/579000/>`_
     for an example lazy sequence built on this algorithm, and links
     to alternatives.
History
Date User Action Args
2015-01-14 06:45:55abarnertsetrecipients: + abarnert, rhettinger, docs@python
2015-01-14 06:45:55abarnertsetmessageid: <1421217955.66.0.420502294095.issue23226@psf.upfronthosting.co.za>
2015-01-14 06:45:55abarnertlinkissue23226 messages
2015-01-14 06:45:54abarnertcreate