Daniel Urban <urban.dani...@gmail.com> added the comment: 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 else: 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)) ---------- keywords: +patch nosy: +durban Added file: http://bugs.python.org/file18111/issue9213.diff _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue9213> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com