hashing strings to integers (was: hashing strings to integers for sqlite3 keys)

Chris Angelico rosuav at gmail.com
Fri May 23 06:59:30 EDT 2014


On Fri, May 23, 2014 at 8:27 PM, Adam Funk <a24061 at ducksburg.com> wrote:
> I've also used hashes of strings for other things involving
> deduplication or fast lookups (because integer equality is faster than
> string equality).  I guess if it's just for deduplication, though, a
> set of byte arrays is as good as a set of int?

Want a better way to do that? Use a set or dict and let Python do the
hashing. It'll be every bit as fast as explicit hashing, plus you get
the bonus of simplicity.

ChrisA



More information about the Python-list mailing list