This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terrence
Recipients loewis, mark.dickinson, michael.foord, pitrou, rhettinger, terrence
Date 2010-02-10.07:53:17
SpamBayes Score 0.018283643
Marked as misclassified No
Message-id <1265788399.85.0.0952737592611.issue7889@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2010-02-10 07:53:20terrencesetrecipients: + terrence, loewis, rhettinger, mark.dickinson, pitrou, michael.foord
2010-02-10 07:53:19terrencesetmessageid: <1265788399.85.0.0952737592611.issue7889@psf.upfronthosting.co.za>
2010-02-10 07:53:18terrencelinkissue7889 messages
2010-02-10 07:53:17terrencecreate