MCPcopy Create free account
hub / github.com/dabeaz-course/practical-python / __getitem__

Method __getitem__

Solutions/8_1/portfolio.py:32–33  ·  view source on GitHub ↗
(self, index)

Source from the content-addressed store, hash-verified

30 return len(self._holdings)
31
32 def __getitem__(self, index):
33 return self._holdings[index]
34
35 def __contains__(self, name):
36 return any(s.name == name for s in self._holdings)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected