MCPcopy Index your code
hub / github.com/python/cpython / IntLike

Class IntLike

Lib/test/test_itertools.py:1237–1241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1235 # Issue #30537: islice can accept integer-like objects as
1236 # arguments
1237 class IntLike(object):
1238 def __init__(self, val):
1239 self.val = val
1240 def __index__(self):
1241 return self.val
1242 self.assertEqual(list(islice(range(100), IntLike(10))), list(range(10)))
1243 self.assertEqual(list(islice(range(100), IntLike(10), IntLike(50))),
1244 list(range(10, 50)))

Callers 1

test_isliceMethod · 0.70

Calls

no outgoing calls

Tested by 1

test_isliceMethod · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…