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 daniel.urban
Recipients daniel.urban, eric.araujo, stutzbach
Date 2010-07-21.20:25:19
SpamBayes Score 0.037269652
Marked as misclassified No
Message-id <>
The attached patch adds the range.count and range.index methods.
Pseudocode for the two method:

def count(self, ob):
    if ob in self:
        return 1
        return 0

def index(self, ob, start=0, stop=len(self)):
    if ob in self:
        idx = (ob - self.start) // self.step
        if start < 0:
            start = start + len(self)
        if stop < 0:
            stop = stop + len(self)
        if start <= idx < stop:
            return idx
    raise ValueError("{!r} is not in range".format(ob))
Date User Action Args
2010-07-21 20:25:22daniel.urbansetrecipients: + daniel.urban, stutzbach, eric.araujo
2010-07-21 20:25:21daniel.urbansetmessageid: <>
2010-07-21 20:25:20daniel.urbanlinkissue9213 messages
2010-07-21 20:25:20daniel.urbancreate