piskvorky / sqlitedict

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

should we have a .copy() method? #20

Closed jquast closed 9 years ago

jquast commented 9 years ago

my use case, i need an in-memory copy of the contents of the whole database for comparison, but I wouldn't like to use my_copy = dict(sdb.items()), but instead just my_copy = sdb.copy()

sound ok?

piskvorky commented 9 years ago

Why, what's wrong with dict(sdb.items())?

jquast commented 9 years ago

Nothing at all, only phonetics in code (and providing same method interface as dict).

One might however be mislead that a .copy() might also have sqlite side-effects or return an sqlitedict instance, so I withdraw the proposal. In such case it is better to explicitly state that this is a "dict-only" copy by dict((sdb.items())