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.

classification
Title: Enhance xrange description by mentioning itertools.repeat
Type: Stage:
Components: Documentation Versions: Python 2.3
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: gerrit, rhettinger
Priority: normal Keywords: patch

Created on 2003-06-14 19:52 by gerrit, last changed 2022-04-10 16:09 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
xrangedoc.diff gerrit, 2003-06-14 19:52
Messages (2)
msg43988 - (view) Author: Gerrit Holl (gerrit) Date: 2003-06-14 19:52
This patch lets the description of the xrange builtin
function include the recently by Alex Martelli on
python-dev described notion that itertools.repeat(None,
n) may be a lot faster than range() or xrange().
msg43989 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-06-28 14:06
Logged In: YES 
user_id=80475

Though "for _ in itertools.repeat(None, n):" offers a small 
speed advantage, it is not as readable as "for i in xrange(n):" 
which should remain the preferred looping idiom.

The purpose of itertools.repeat() is to supply repeated 
arguments to imap() and izip().  Its secondary purpose is to 
provide a memory friendly version of "[obj] * n".   Using it as 
a speedup for xrange() should only be used in rare situations 
where a slight performance gain is essential.
History
Date User Action Args
2022-04-10 16:09:14adminsetgithub: 38651
2003-06-14 19:52:07gerritcreate