4 ms·
Both cases are an index error. It's just for some other reasons in case of the section, the error is represented by an empty object and it's left to user to han
by zoomablemind 3y ago
Both cases are an index error. It's just for some other reasons in case of the section, the error is represented by an empty object and it's left to user to handle the result.
This could easily conceal the indexing error unless the caller code explicitly checks the length of the returned section.
- hk__2 3y ago> This could easily conceal the indexing error unless the caller code explicitly checks the length of the returned section. An empty returned section doesn’t mean the index was out of bounds (`a[0:0]`); if you want to make sure you have to check the length before slicing, like in Go.
- zoomablemind 3y agoHere it is. It only underscores the ambiguity of such handling of the section indexes. Flagging the index error would make this less ambiguous/silent.