[Python-checkins] cpython (2.7): Issue 12003: fixing error in xrange alternative sample

eli.bendersky python-checkins at python.org
Mon May 23 05:10:51 CEST 2011


http://hg.python.org/cpython/rev/76e5fe8e21fd
changeset: 70284:76e5fe8e21fd
branch: 2.7
user: Eli Bendersky <eliben at gmail.com>
date: Mon May 23 06:10:26 2011 +0300
summary:
 Issue 12003: fixing error in xrange alternative sample
files:
 Doc/library/functions.rst | 2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -1464,7 +1464,7 @@
 also requires that the number of elements fit in a native C long. If a
 larger range is needed, an alternate version can be crafted using the
 :mod:`itertools` module: ``islice(count(start, step),
- (stop-start+step-1)//step)``.
+ (stop-start+step-1+2*(step<0))//step)``.
 
 
 .. function:: zip([iterable, ...])
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /