Terrence Cole <terre...@zettabytestorage.com> added the comment: Thank you for all the help! I'm glad to see that the use of hash() on buffer compatible objects is an actual gotcha and not just me being obtuse.
Also, for those googling who, like me, won't be able to use 3.2's from_bytes until 3.2 is released in December, here is code to convert a bytes to an int: >>> n = 0 >>> off = 0 >>> data = b'\xfc\x00' >>> for c in data[::-1]: ... n += c << off ... off += 8 ... >>> print(n) 64512 Or, if you prefer the functional style: >>> sum([c<<off for c,off in zip(data[::-1],range(0,len(data)*8+1,8))]) 64512 ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue7889> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com