MCPcopy Create free account
hub / github.com/pybind/pybind11 / BareSequenceLike

Class BareSequenceLike

tests/test_stl.py:600–608  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

598
599 # Implements the Sequence protocol without explicitly inheriting from collections.abc.Sequence.
600 class BareSequenceLike:
601 def __init__(self, *args):
602 self.data = tuple(args)
603
604 def __len__(self):
605 return len(self.data)
606
607 def __getitem__(self, index):
608 return self.data[index]
609
610 # Implements the Sequence protocol by reusing BareSequenceLike's implementation.
611 # Additionally, inherits from collections.abc.Sequence.

Callers 1

Calls

no outgoing calls

Tested by 1