Re: [Python-Dev] RFC: PEP 460: Add bytes % args and bytes.format(args) to Python 3.5

2014年1月10日 14:22:52 -0800

On 1/10/2014 5:12 PM, Victor Stinner wrote:
> 2014年1月10日 Juraj Sukop <[email protected]>:
>> In the case of PDF, the embedding of an image into PDF looks like:
>>
>> 10 0 obj
>> << /Type /XObject
>> /Width 100
>> /Height 100
>> /Alternates 15 0 R
>> /Length 2167
>> >>
>> stream
>> ...binary image data...
>> endstream
>> endobj
> 
> What not building "10 0 obj ... stream" and "endstream endobj" in
> Unicode and then encode to ASCII? Example:
> 
> data = b''.join((
> ("%d %d obj ... stream" % (10, 0)).encode('ascii'),
> binary_image_data,
> ("endstream endobj").encode('ascii'),
> ))
Isn't the point of the PEP to make it easier to port 2.x code to 3.5? Is
there really existing code like this in 2.x?
I think what we're trying to do is to make code that looks like:
 b'%d %d obj ... stream' % (10, 0)
work in both 2.x and 3.5.
But correct me if I'm wrong. I'll admit to not following 100% of these
emails.
Eric.
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to