[Python-checkins] r79796 - python/branches/release26-maint/Doc/library/functions.rst

georg.brandl python-checkins at python.org
Mon Apr 5 13:46:16 CEST 2010


Author: georg.brandl
Date: Mon Apr  5 13:46:16 2010
New Revision: 79796

Log:
#7721: replace code that works only in 2.7+ with equivalent.

Modified:
   python/branches/release26-maint/Doc/library/functions.rst

Modified: python/branches/release26-maint/Doc/library/functions.rst
==============================================================================
--- python/branches/release26-maint/Doc/library/functions.rst	(original)
+++ python/branches/release26-maint/Doc/library/functions.rst	Mon Apr  5 13:46:16 2010
@@ -1390,8 +1390,8 @@
       restricts all arguments to native C longs ("short" Python integers), and
       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)``.
+      :mod:`itertools` module: ``takewhile(lambda x: x<stop, (start+i*step
+      for i in count()))``.
 
 
 .. function:: zip([iterable, ...])


More information about the Python-checkins mailing list