Guido van Rossum wrote:
>>>
>>>> - make == and != between PyBytes and PyUnicode return False instead of
>>>> raising TypeError
>>>>
>>>>
Just thinking about it I'm pretty sure my initial patch is wrong -
forgive my ignorance. To remove the ambiguity, is it fair to state the
following?
bytes() == str() -> False instead of raising TypeError
bytes() != str() -> True instead of raising TypeError
I initially read that as "return False whenever any comparison between
bytes and unicode objects is attempted" ...
> Assuming that PyUnicode_Compare is a three-way comparison (less,
> equal, more), it should raise a TypeError when one of the arguments is
> a PyString or PyBytes.
>
>
Cool. Should have that sorted out soon. As above:
str8() == str() -> False
str8() != str() -> True
Correct?
>> Is it just me, or do string/bytes comparisons already work?
>>
>> >>> s = str8('test')
>> >>> b = b'test'
>> >>> s == b
>> True
>> >>> b == s
>> True
>> >>> s != b
>> False
>> >>> b != s
>> False
>>
>
> Seems it's already so. Do they order properly too? (< <= > >=)
>
Looks like it:
>>> str8('a') > b'b'
False
>>> str8('a') < b'b'
True
>>> str8('a') <= b'b'
True
>>> str8('a') >= b'b'
False
Cheers,
Tom
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com