[New-bugs-announce] [issue2690] Precompute range length

Alexander Belopolsky report at bugs.python.org
Fri Apr 25 17:32:02 CEST 2008


New submission from Alexander Belopolsky <belopolsky at users.sourceforge.net>:

Attached patch makes range objects precompute their length on creation.  
This speeds up indexing and len at the expense of a small increase in 
range object size.  The main benefit, however is that unsupported length > 
sys.maxsize is detected early and confusing OverflowError from len(r) or 
r[i] is avoided.

See discussion starting at http://mail.python.org/pipermail/python-
3000/2008-April/013225.html .

----------
components: Interpreter Core
files: range-length.diff
keywords: patch
messages: 65786
nosy: belopolsky
severity: normal
status: open
title: Precompute range length
type: performance
versions: Python 3.0
Added file: http://bugs.python.org/file10107/range-length.diff

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2690>
__________________________________


More information about the New-bugs-announce mailing list