Maybe change PadoDataset.__getitem__
exceptions
#18
Labels
🚧 refactor
Requires refactoring / redesign
PadoDataset.__getitem__
exceptions
#18
We provide a
Mapping[ImageId, PadoItem]
interface with__getitem__
and__len__
in which we correctly (and intuitively) raise
KeyError(image_id)
Now additionally we'd like to provide a
Sequence[PadoItem]
interface, again via__getitem__
and__len__
and again correctly (and to me intuitively) raiseIndexError(int_idx)
If the two are merged (as it is now), the user must understand which Exception to catch when using either integer indexing or ImageId indexing (i.e. the Sequence interface or the Mapping interface).
While intuitive to some, this behavior might confuse people who haven't read the
collections.abc
module a few times. Which is why I believe there's value in separating the two interfaces explicity.So maybe offer
Mapping[ImageId, PadoItem]
on the dataset, andSequence[PadoItem]
via a proxy attribute.The text was updated successfully, but these errors were encountered: