There is quite a bit of indirection here. Follow me carefully.
The shelve module is implemented on top of the anydbm module. This module acts as a facade for 4 different concrete DBM implementations, and it selects the first module available when creating a new database in the following order:
dbhash (outdated, but still the first anydbm choice). This is a proxy for the bsddb module, .open() really bsddb.hashopen()gdbm , the Python module for the GNU DBM library, which offers more functionality than the dbm module, can offer when used with the same lbrary.dbm , a proxy module using the ndbm , BSD DB and GNU DBM libraries (selected when compiling Python).dumbdbm , a pure-python implementation.
It is this range of choice that makes shelve files seem to increase additional extensions on different platforms.
The dumbdbm module is the one that adds the .bak , .dat and .dir :
Open the dumbdbm database and return the dumbdbm object. The file name argument is the base name of the database file (without any specific extensions). When the damper database is created, files with the extensions .dat and .dir .
The .dir file .dir moved to .dir because new index indexes are .dir to changes made to the data structures.
This means that the other three anydbm options anydbm not available on your platform.
Other formats may provide you with other extensions. The dbm module can use .dir , .pag or .db , depending on which library was used for this module.
Martijn pieters
source share