[Python-Dev] Python 3.x and bytes (original) (raw)
"Martin v. Löwis" martin at v.loewis.de
Wed May 18 21:06:09 CEST 2011
- Previous message: [Python-Dev] Python 3.x and bytes
- Next message: [Python-Dev] Python 3.x and bytes
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Note that the more common idiom (not that I can measure it, mind) when dealing with byte strings is something analogous to
if mybytestring[i:i+1] == b'x': rather than if mybytestring[i] == 170:
FWIW, Another spelling of this is
if my_byte_string[i] == ord(b'x')
From a readability point, it's in the same category as the first one, but less twisted.
Regards, Martin
- Previous message: [Python-Dev] Python 3.x and bytes
- Next message: [Python-Dev] Python 3.x and bytes
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]