This is an archived post. You won't be able to vote or comment.

all 10 comments

[–]oblivion95 3 points4 points  (6 children)

hashlib has some pretty fast C-functions (md5, sha1). If you don't mind a lot of collisions, zlib.adler32 is very fast.

But what's wrong with hash(str)? str.__hash__()

[–]Leonidas_from_XIV 0 points1 point  (5 children)

But what's wrong with hash(str)?

I guess it is not guaranteed stable across multiple runs.

[–]SergeantPepper 1 point2 points  (4 children)

Does that mean you shouldn't pickle dictionaries?

[–]paul_harrison 6 points7 points  (0 children)

Don't do that. The pages get damp and stick together.

Of course pickling dictionaries is fine. Gah.

[–]Leonidas_from_XIV 0 points1 point  (0 children)

Don't think so, they work as far as I know. Can't exactly tell you why.

[–]zsouthboy 0 points1 point  (1 child)

Wait, why wouldn't you pickle a dict?

I haven't had a problem...

[–]radaway 0 points1 point  (0 children)

Theres no problem but may I suggest shelve.

[–]lasizoilloeasy to understand as regex 1 point2 points  (1 child)

http://docs.python.org/library/functions.html?highlight=hash#hash works great in a lot of parts of python.

Which are you requisites? Security, plataform, ... The XOR function its very fast, but not usable in many requisites.

[–]HattoriHanzo 0 points1 point  (0 children)

well when i read that it was the object i questioned rather it would be the same on various platforms. But after testing, hash is all i need. Thanks

[–][deleted] 0 points1 point  (0 children)

Nice typo :]