Skip to main content

Implementation of a dictionary in a temporary directory

Project description

dictondisk

It's a thing that implements a dictionary, but in a temporary directory.

Why?

I had a machine with not a lot of RAM and a script that was RAM-hungry. Instead of optimizing the script i did this montrostity.

Should you use it?

Probably not. It's slow. I'm almost certain there are many security flaws in this approach.

How to use dictondisk?

from dictondisk import DictOnDisk

some_dict = DictOnDisk()

some_dict[1] = "One"
some_dict[2] = "Two"
some_dict[3] = "Three"

del some_dict[1]

for key, value in some_dict.items():
    print(key, value)

Comparison to the vanilla dict

Action dict() DictOnDisk()
Preserve insertion order ✔️
len(d) ✔️ ✔️
d[key] ✔️ ✔️
d[key] = value ✔️ ✔️
del d[key] ✔️ ✔️
key in d ✔️ ✔️
key not in d ✔️ ✔️
iter(d) ✔️ ✔️
d.clear() ✔️ ✔️
d.copy() ✔️ ✔️
d.fromkeys() ✔️ ✔️
d.get(key[, default]) ✔️ ✔️
d.items() ✔️ ✔️
d.keys() ✔️ ✔️
d.pop(key[, default]) ✔️ ✔️
d.popitem() ✔️ ✔️
d.setdefault(key[, default]) ✔️ ✔️
d.update([other]) ✔️ ✔️
d.values() ✔️ ✔️
bool(d) ✔️ ✔️
d1 == d2 ✔️ ✔️
d1 != d2 ✔️ ✔️

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dictondisk-1.3.tar.gz (5.3 kB view details)

Uploaded Source

File details

Details for the file dictondisk-1.3.tar.gz.

File metadata

  • Download URL: dictondisk-1.3.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.8

File hashes

Hashes for dictondisk-1.3.tar.gz
Algorithm Hash digest
SHA256 6cefdf20bb7b77b037c23dc3acd6514fccc82dbd1b79c82fcc25f235cbeb3410
MD5 c09e4e20bb5abda2e15a699d91d41fbd
BLAKE2b-256 74eec0386fee9b1a8e7267eff4945a2daeeea07cdeb6b403ba621e33cebd31a5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page