Author arjennienhuis
Recipients arjennienhuis, benjamin.peterson, eric.smith, loewis, vstinner
Date 2009-07-11.13:54:37
SpamBayes Score 4.32572e-05
Marked as misclassified No
Message-id <1247320480.38.0.277534478263.issue3982@psf.upfronthosting.co.za>
In-reply-to
Content
There are many binary formats that use ASCII numbers.

'HTTP chunking' uses ASCII mixed with binary (octets).

With 2.6 you could write:

def chunk(block):
    return b'{0:x}\r\n{1}\r\n'.format(len(block), block)

With 3.0 you'd have to write this:

def chunk(block):
    return format(len(block), 'x').encode('ascii') + b'\r\n' + block +
b'\r\n'

You cannot convert to ascii at the end of the pipeline as there are
bytes > 127 in the data blocks.
History
Date User Action Args
2009-07-11 13:54:40arjennienhuissetrecipients: + arjennienhuis, loewis, vstinner, eric.smith, benjamin.peterson
2009-07-11 13:54:40arjennienhuissetmessageid: <1247320480.38.0.277534478263.issue3982@psf.upfronthosting.co.za>
2009-07-11 13:54:38arjennienhuislinkissue3982 messages
2009-07-11 13:54:37arjennienhuiscreate