A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2011-May/111463.html below:

[Python-Dev] Python 3.x and bytes

[Python-Dev] Python 3.x and bytes [Python-Dev] Python 3.x and bytesGeorg Brandl g.brandl at gmx.net
Wed May 18 21:47:43 CEST 2011
On 18.05.2011 21:06, "Martin v. Löwis" wrote:
>> Note that the more common idiom (not that I can measure it, mind)
>> when dealing with byte strings is something analogous to
>> 
>>     if my_byte_string[i:i+1] == b'x':
>> 
>> rather than
>> 
>>     if my_byte_string[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.

Probably more twisted:

if my_byte_string[i] == b'x'[0]:

:)

Georg

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4