New submission from ipatrol:

https://docs.python.org/3/reference/expressions.html#comparisons says that 
"Strings and binary sequences cannot be directly compared." That would seem to 
me to imply that an equality between them would raise an exception, as also 
claimed by https://wiki.python.org/moin/BytesStr

However, that is manifestly incorrect. Bytes and strings can be compared: they 
are always unequal. This appears to be a result of the operation falling 
through to the default comparison, which returns False since they are not 
identical objects. Equality is a comparison, though it is not an order 
comparison. A brief search of the word "cannot" in the documentation suggest 
that saying a certain thing cannot be done usually implies that attempting to 
do so anyway will raise an exception, typically a TypeError. That this is not 
the case for string-bytes comparisons should be mentioned.

----------
assignee: docs@python
components: Documentation
messages: 294200
nosy: docs@python, ipatrol
priority: normal
severity: normal
status: open
title: Documentation either unclear or incorrect on comparisons between bytes 
and strings in Python 3
type: behavior
versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30435>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to