[Python-3000] PEP 3137 plan of attack

Thomas Lee tom at vector-seven.com
Tue Oct 9 15:31:16 CEST 2007


Thomas Lee wrote:
> Guido van Rossum wrote:
>   
>> - make == and != between PyBytes and PyUnicode return False instead of
>> raising TypeError
>>     
A patch for this is ready. I'll submit it to the bug tracker later tonight.
>> - make == and != between PyString and Pyunicode return False instead
>> of converting
>>     
This will be trivial, but I need to ask a stupid question: is this also 
true for PyUnicode_Compare? (i.e. should PyUnicode_Compare(str8(), 
str()) != 0 ?)

And, if so, what should PyUnicode_Compare actually return if one of the 
parameters is a PyString? Maybe -1 for PyUnicode on the left, 1 for 
PyUnicode on the right?
>> - make comparisons between PyString and PyBytes work (these are
>> properly ordered)
>>   
>>     
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

Cheers,
Tom


More information about the Python-3000 mailing list