i2mint / py2store

Tools to create simple and consistent interfaces to complicated and varied data sources.
MIT License
11 stars 2 forks source link

Stores should raise `LookupError` instead of `KeyError` #68

Open thorwhalen opened 4 years ago

thorwhalen commented 4 years ago

LookupError is the mother of both KeyError and IndexError, which is used by some containers.

"Index" seems to refer to an incremental integer key.

In py2store containers though, keys are meant have (unless otherwise specified) a looser semantic. They can actually be anything (even a non-hashable) that references some content.

Therefore, it may be better, at least at the base(r) levels that we use LookupError instead of what is used now: KeyError.