[docs] Doc: remove errors about mixed-type comparisons. (issue 12067)

storchaka+cpython at gmail.com storchaka+cpython at gmail.com
Sun Jan 22 05:53:41 EST 2017


http://bugs.python.org/review/12067/diff/19802/Doc/reference/expressions.rst
File Doc/reference/expressions.rst (right):

http://bugs.python.org/review/12067/diff/19802/Doc/reference/expressions.rst#newcode1154
Doc/reference/expressions.rst:1154: 8-bit strings are fully
interoperable in this behavior. [#]_
On 2017/01/22 06:22:58, vadmium wrote:
> On 2017/01/21 13:03:53, storchaka wrote:
> > This description is misleading. Unicode and 8-bit strings are not
fully
> > interoperable.
> > 
> > >>> chr(0xff) == unichr(0xff)
> > __main__:1: UnicodeWarning: Unicode equal comparison failed to
convert both
> > arguments to Unicode - interpreting them as being unequal
> > False
> > >>> chr(0xff) < unichr(0xff)
> > Traceback (most recent call last):
> >   File "<stdin>", line 1, in <module>
> > UnicodeDecodeError: 'ascii' codec can't decode byte 0xff in position
0:
> ordinal
> > not in range(128)
> > 
> > When compare str and unicode, the str operand is converted to
Unicode. If the
> > conversion is failed, values are traited as non-equal.
> 
> Okay, I shall replace the second sentence with:
> 
> When comparing an 8-bit string and a Unicode string, the 8-bit string
is
> converted to Unicode. If the conversion fails, the strings are
considered
> unequal.

LGTM. Sorry, I'm not good in reviewing the documentation. I just checked
some technical details. You need other reviewer to checking your wording
or just commit your patch if you are feeling it correct (I trust your
experience and taste).

http://bugs.python.org/review/12067/


More information about the docs mailing list