[Python-3000] PEP 3137 plan of attack
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 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?
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