MCPcopy Create free account
hub / github.com/webpy/webpy / __getitem__

Method __getitem__

web/utils.py:696–708  ·  view source on GitHub ↗
(self, i)

Source from the content-addressed store, hash-verified

694 self.c += 1
695
696 def __getitem__(self, i):
697 # todo: slices
698 if i < self.c:
699 raise IndexError("already passed " + str(i))
700 try:
701 while i > self.c:
702 next(self.i)
703 self.c += 1
704 # now self.c == i
705 self.c += 1
706 return next(self.i)
707 except StopIteration:
708 raise IndexError(str(i))
709
710 def __nonzero__(self):
711 if hasattr(self, "__len__"):

Callers

nothing calls this directly

Calls 1

nextFunction · 0.85

Tested by

no test coverage detected