[issue15224] Range: Additional Methods (min/max/__and__)

Serhiy Storchaka report at bugs.python.org
Sat Jun 30 08:13:22 CEST 2012


Serhiy Storchaka <storchaka at gmail.com> added the comment:

> On a side note, glancing at Python-3.3.0a4/Objects/rangeobject.c:
> range_contains seems to iterate through the entire range whereas __contains__ from the attached Range.py is O(1)

See issue1766304. For int range.__contains__ is O(1), for custom types this optimization is impossible without losing backward compatibility.

----------
nosy: +storchaka

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15224>
_______________________________________


More information about the Python-bugs-list mailing list