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/111490.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
Thu May 19 07:28:36 CEST 2011
On 19.05.2011 00:39, Greg Ewing wrote:
> Ethan Furman wrote:
> 
>> some_var[3] == b'd'
>> 
>> 1) a check to see if the bytes instance is length 1
>> 2) a check to see if
>>    i) the other object is an int, and
>>    2) 0 <= other_obj < 256
>> 3) if 1 and 2, make the comparison instead of returning NotImplemented?
> 
> It might seem convenient, but I'd worry that it would lead to
> even more confusion in other ways. If someone sees that
> 
>     some_var[3] == b'd'
> 
> is true, and that
> 
>     some_var[3] == 100
> 
> is also true, they might expect to be able to do things
> like
> 
>     n = b'd' + 1
> 
> and get 101... or maybe b'e'...

Maybe they should :)

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