23.03.21 07:55, Vijay Patel пише: > Suggestion: > 1. Big Set, Big Dictionary - > During design time, i am considering this question. With limited RAM > (example 4 GB), how can I store a dictionary/set of size greater than RAM. > > Is it possible to introduce Big Set / Big Dictionary which stores data > in hard disk (based on some partition mechanism - like big data)? > (i.e.Big Set/Big Dictionary with set access mechanism identical to > current set and dictionary).
Look at the shelve module. It provides a dict-like class with permanent storage. It can be used to work with data larger than the RAM volume if you sync the cache at times. It has limitations: keys can only be strings. It would be not easier to support arbitrary objects as keys because the pickle protocol does not guarantee that equal values are serialized to the same data. But if you need to work with non-string keys, you can write your own wrapper which serializes your keys to strings. In any case you can take that implementation as an example and write your own implementation which suits your needs. I do not think it will be added in the stdlib, as it looks pretty niche solution, but you can publish it on PyPI. _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/F6CM7JMLL6DKM32BKVNNTNKDRXLIERS3/ Code of Conduct: http://python.org/psf/codeofconduct/