(original) (raw)

On 5/17/2011 10:39 PM, Greg Ewing wrote:
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.

Much nicer would be

   some\_var = x'deadbeef'

As for

--> some\_other\_var\[3\] == b'd'

there ought to be a literal for specifying an integer
using an ascii character, so you could say something like

  if some\_other\_var\[3\] == c'd':

which would be equivalent to

  if some\_other\_var\[3\] == ord(b'd')

but without the overhead of computing the value each time
at run time.

+1

Seems this could be added compatibly?