Supporting list()

Skip Montanaro skip at
Mon Dec 17 16:51:59 CET 2012

> If using __getitem__ it needs to work with integers from 0 to len(f)-1,
> and raise IndexError for len(f), len(f+1), etc.

Ah, thanks.  I have a __getitem__ method, but it currently doesn't raise
IndexError.  (I'm indexing into a ring buffer, and the usage of the class
pretty much precludes indexing with an out-of-bounds index.)


More information about the Python-list mailing list