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 woparry
Recipients asvetlov, docs@python, ezio.melotti, paddy3118, woparry
Date 2013-05-25.21:05:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1369515907.34.0.379857181404.issue16580@psf.upfronthosting.co.za>
In-reply-to
Content
Patch adding examples + tests for equivalence. Comments appreciated.

In particular, I'm not sure that the from_bytes example is simple enough to be useful:

def from_bytes(bytes, byteorder, signed=False):
    if byteorder == 'little':
        little_ordered = list(bytes)
    elif byteorder == 'big':
        little_ordered = list(reversed(bytes))
     n = sum(little_ordered[i] << i*8 for i in range(len(little_ordered)))
    if signed and little_ordered and (little_ordered[-1] & 0x80):
         n -= 1 << 8*len(little_ordered)
    return n
History
Date User Action Args
2013-05-25 21:05:07woparrysetrecipients: + woparry, paddy3118, ezio.melotti, asvetlov, docs@python
2013-05-25 21:05:07woparrysetmessageid: <1369515907.34.0.379857181404.issue16580@psf.upfronthosting.co.za>
2013-05-25 21:05:07woparrylinkissue16580 messages
2013-05-25 21:05:07woparrycreate