A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-July/067816.html below:

[Python-Dev] Bad interaction of __index__ and sequence repeat

[Python-Dev] Bad interaction of __index__ and sequence repeat [Python-Dev] Bad interaction of __index__ and sequence repeatGreg Ewing greg.ewing at canterbury.ac.nz
Sat Jul 29 05:09:46 CEST 2006
Tim Peters wrote:

> So, e.g., plain a[i] shouldn't use __index__ either if i is already
> int or long.  I don't see any justification for invoking nb_index in
> sequence_repeat(), although if someone thinks it should, then as for
> plain indexing it certainly shouldn't invoke nb_index if the incoming
> count is an int or long to begin with.

Hmmm. So that means anything accepting an integer index
needs to do its own range checking anyway. So having
__index__ do clipping is at best unnecessary and at worst
counterproductive, since it could suppress an overflow
or range exception that *should* be produced by the code
using the index, and would be if it got the equivalent
index value as an int or long directly.

--
Greg
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4