Mark Dickinson <dicki...@gmail.com> added the comment:

max and min for a range object are already O(1) one-liners:

>>> a = range(3, 21, 5)
>>> a[-1] if a.step > 0 else a[0]  # max(a)
18
>>> a[0] if a.step > 0 else a[-1]  # min(a)
3

As for __and__, it doesn't feel like a particularly natural operation to me, 
given that a range object represents an *ordered* sequence of integers rather 
than just a subset.  For example, what should the first element of

  range(7, -3, -2) & range(10)

be? 7 or 1? And why?

----------
nosy: +mark.dickinson

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue15224>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to