18 May
2011
18 May
'11
5:46 a.m.
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?