Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fd9e1cd commit 4faa5f0Copy full SHA for 4faa5f0
1 file changed
lib/utils/xrange.py
@@ -54,6 +54,9 @@ def __len__(self):
54
def _len(self):
55
return max(0, int((self.stop - self.start) / self.step))
56
57
+ def __contains__(self, value):
58
+ return (self.start <= value < self.stop) and (value - self.start) % self.step == 0
59
+
60
def __getitem__(self, index):
61
if isinstance(index, slice):
62
start, stop, step = index.indices(self._len())
0 commit comments