3 ms·
According to documentation it is not so much a db included as an interface to one: > dbm is a generic interface to variants of the DBM database — dbm.gnu or db
by wodenokoto 4y ago
According to documentation it is not so much a db included as an interface to one:
> dbm is a generic interface to variants of the DBM database — dbm.gnu or dbm.ndbm. If none of these modules is installed, the slow-but-simple implementation in module dbm.dumb will be used. There is a third party interface to the Oracle Berkeley DB
https://docs.python.org/3/library/dbm.html https://docs.python.org/3/library/dbm.html
- chrismorgan 4y agoWhen it includes a fallback implementation so that you can rely on it working, I think it’s fair to call it “included”.
- qalmakka 4y agoThe main issue here is that, given it relies on whatever implementation of DBM you have installed, its performance will vary considerably from OS to OS. I don't know how fast or slow the "dumb" implementation is, but I can bet it is way slower than gdbm. I can see someone using this module, considering it "fast enough" on GNU/Linux and then finding out that it's painfully slow on Windows and shipping binaries of another implementation is a massive PITA.
- cozzyd 4y agoRight but the on-disk formats between versions won't be compatible...
- tootie 4y agoYeah, dbm is a posix database utility that's been around forever. There's a few implementations available and there are bindings for most languages. https://en.wikipedia.org/wiki/DBM_(computing) https://en.wikipedia.org/wiki/DBM_(computing)
- tyingq 4y agoEach of which has it's own set of limitations and watch-outs. I would not use the python dbm interface for anything serious. Ndbm, for example, has a per item value limit that varies between ~1-4k.