title: Why does Python's shelve require that all keys be strings?
body: <p>It's well-documented that Python's shelve module requires all keys to be strings and that there are various workarounds (see threads <a href="https://stackoverflow.com/questions/4013452/how-do-i-take-integer-keys-in-shelve">here</a> and <a href="https://stackoverflow.com/questions/2853113/database-backed-dictionary-with-arbitrary-keys/2854741#2854741">here</a>). My question is, <em>why</em> does shelve require string keys? Given that I can pickle a dict that uses other objects as keys, and that shelve uses pickle under the hood, why can't shelve handle such keys itself? Do string keys make it vastly simpler to update only a piece of the persistent object rather than having to rewrite the whole thing (and if so, why)?</p>