piskvorky / sqlitedict

Persistent dict, backed by sqlite3 and pickle, multithread-safe.
Apache License 2.0
1.16k stars 130 forks source link

adding optional (not enabled by default) ability to encode keys #161

Closed rdyro closed 1 year ago

rdyro commented 1 year ago

This pull requests adds the optional behavior of encoding keys.

The justification: support for hashable, but not str (or int) keys, e.g. tuple as a key.

The changes include:

Potential problems:

mpenkov commented 1 year ago

Can you please fix the flake8 errors in the code as well?

https://github.com/RaRe-Technologies/sqlitedict/actions/runs/3303841568/jobs/5456104420

rdyro commented 1 year ago

I just fixed the flake8 errors.

Would documenting this optional key encoding in the README be a good idea? I added a commit for that.

rdyro commented 1 year ago

Could we merge this into master?

This PR adds attempts to add a useful optional feature, while introducing minimum extra complexity and not affecting performance.

mpenkov commented 1 year ago

Yes, of course. I've merged your work. Thank you!