On Tue, 28 Mar 2000, Barry A. Warsaw wrote: > > Changing the definition of class Nums to > > class Nums: > def __getitem__(self, i): > if 0 <= i < 10: return i > raise IndexError > def __len__(self): > return 10 > > I.e. adding the __len__() method avoids the SystemError. It should be noted that "apply" has the same problem, with a different counterintuitive error message: >>> n = Nums() >>> apply(sum, n) Traceback (innermost last): File "<stdin>", line 1, in ? AttributeError: __len__ -- ?!ng
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4