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

Method index

Lib/multiprocessing/shared_memory.py:534–542  ·  view source on GitHub ↗

L.index(value) -> integer -- return first index of value. Raises ValueError if the value is not present.

(self, value)

Source from the content-addressed store, hash-verified

532 return sum(value == entry for entry in self)
533
534 def index(self, value):
535 """L.index(value) -> integer -- return first index of value.
536 Raises ValueError if the value is not present."""
537
538 for position, entry in enumerate(self):
539 if value == entry:
540 return position
541 else:
542 raise ValueError("ShareableList.index(x): x not in list")
543
544 __class_getitem__ = classmethod(types.GenericAlias)

Calls 1

enumerateFunction · 0.85