[Python-ideas] Python 3.x and bytes
Stephen J. Turnbull
stephen at xemacs.org
Tue May 24 04:40:46 CEST 2011
Bruce Leban writes:
> I recognize that the compiler can optimize:
>
> > if bytesdata[i] == b'x'[0]:
>
> but that looks like chicken scratches to me.
Using named constants should fix that, and is better style anyway.
> Someone suggested using 0'x' which I don't quite get. It looks too much like
> 0x to me
True but minor, IMO YMMV.
> and the I've always read the leading zero to mean 'this is a
> number'.
That's precisely Nick's point in suggesting it!
More information about the Python-ideas
mailing list