[issue30435] Documentation either unclear or incorrect on comparisons between bytes and strings in Python 3

Eryk Sun report at bugs.python.org
Tue May 23 01:25:35 EDT 2017


Eryk Sun added the comment:

How about "cannot be compared by value" or "cannot be ordered by value"? Emphasizing the value aspect doesn't conflict with the default equality comparison by identity.

Note that starting Python with the -b option causes the bytes type to raise a warning in this case:

    >>> sys.flags.bytes_warning
    1
    >>> 'a'.__eq__(b'a')
    NotImplemented

    >>> b'a'.__eq__('a')
    __main__:1: BytesWarning: Comparison between bytes and string
    NotImplemented

----------
nosy: +eryksun

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30435>
_______________________________________


More information about the Python-bugs-list mailing list