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.

Author mark.dickinson
Recipients Yclept.Nemo, mark.dickinson
Date 2012-06-29.17:02:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1340989346.45.0.0351452219527.issue15224@psf.upfronthosting.co.za>
In-reply-to
Content
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?
History
Date User Action Args
2012-06-29 17:02:26mark.dickinsonsetrecipients: + mark.dickinson, Yclept.Nemo
2012-06-29 17:02:26mark.dickinsonsetmessageid: <1340989346.45.0.0351452219527.issue15224@psf.upfronthosting.co.za>
2012-06-29 17:02:25mark.dickinsonlinkissue15224 messages
2012-06-29 17:02:25mark.dickinsoncreate