[Python-Dev] Python 3.x and bytes
g.brandl at gmx.net
Wed May 18 08:31:28 CEST 2011
On 18.05.2011 07:39, Greg Ewing wrote:
> Ethan Furman wrote:
>> On the one hand we have the 'bytes are ascii data' type interface, and
>> on the other we have the 'bytes are a list of integers between 0 - 256'
> I think the weird part is that there exists a literal for
> writing a byte array as an ascii string, and furthermore
> that it's the *only* kind of literal available for bytes.
> Personally I think that the default literal syntax for
> bytes, and also the form produced by repr(), should have
> been something more neutral, such as hex, with the ascii
> form available for use when it makes sense. Currently if
> you want to write a bytes literal in hex, you have to
> say something like
> some_var = b'\xde\xad\xbe\xef'
> which is ugly and unreadable. Much nicer would be
> some_var = x'deadbeef'
We do have
More information about the Python-Dev