On 02/08/2018 08:20, Steven D'Aprano wrote:
On Wed, 01 Aug 2018 22:14:54 +0300, Serhiy Storchaka wrote:

...........
Not always. If your code supported Python 2 in the past, or third-party
dependencies supports or supported Python 2, this warning can expose a
real bug. Even if all your and third-party code always was Python 3
only, the standard library can contain such kind of bugs.

Several years after the EOL of Python 2.7 and moving all living code to
Python 3 we can ignore bytes warnings as always false positive.

Even then, I don't know that we should do that. I do not believe that the
EOL of Python 2 will end all confusion between byte strings and text
strings. There is ample opportunity for code to accidentally compare
bytes and text even in pure Python 3 code, e.g. comparing data read from
files reading from files which are supposed to be opened in the same
binary/text mode but aren't.



I think I agree; when python 2 is history I can drop all the messing about with bytes in the input and clean up the code a lot. Stuff like svg and xml will still need conversions which are generally unknown in advance.

The output will need converting to bytes, but that's fairly standard.
--
Robin Becker

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to