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

Method __getitem__

Solutions/7_4/portfolio.py:13–14  ·  view source on GitHub ↗
(self, index)

Source from the content-addressed store, hash-verified

11 return len(self._holdings)
12
13 def __getitem__(self, index):
14 return self._holdings[index]
15
16 def __contains__(self, name):
17 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