[Python-3000] PEP 3137 plan of attack (original) (raw)

Guido van Rossum guido at python.org
Tue Oct 9 17:01:02 CEST 2007


On 10/9/07, Thomas Lee <tom at vector-seven.com> wrote:

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 PyUnicodeCompare? (i.e. should PyUnicodeCompare(str8(), str()) != 0 ?)

And, if so, what should PyUnicodeCompare actually return if one of the parameters is a PyString? Maybe -1 for PyUnicode on the left, 1 for PyUnicode on the right?

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.

>> - 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

Seems it's already so. Do they order properly too? (< <= > >=)

-- --Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-3000 mailing list