Closed keaganlong closed 2 weeks ago
I see, that makes sense. It wouldn't impact current workflows anyways since an error is thrown regardless, but having IndexError
would be more pythonic. If you're up for it, could you submit a small PR? I'd be happy to review, so feel free to tag me.
https://github.com/mosaicml/streaming/blob/0b055ffcbce130ea7c5a99cd35fe2ec7702af4ac/streaming/base/spanner.py#L52
Hello, curious if it might be more customary to use python's
IndexError
instead of your customValueError
when an index is out of bounds in__getitem__
. One consequence of using the current setup is that you will get aValueError
exception when you useSpanner
/LocalDataset
/etc as an iterator. Python allows objects with a__getitem__
to be used as an iterator but it expects to catch and stop onIndexError
.