2to3?
2to3?
Posted May 30, 2025 1:33 UTC (Fri) by Cyberax (✭ supporter ✭, #52523)In reply to: 2to3? by zahlman
Parent article: Recent disruptive changes from Setuptools
Yes, thanks for the correction.
> It's a little hard to imagine how an error handler failing to convert between str and bytes could cause such a headache - because an error handler would presumably be formatting *an error message*, which means the left-hand side should clearly be a string *literal*.
You lose the original error message and get a useless type mismatch exception as a result. Which is NOT helpful when you're trying to debug the code that led to the error using logs.
> If you mean that code decoded byte data into strings in order to be formatted, and then wasn't properly converted back to bytes, I sympathize; but the original 2.x code in this case *was then already broken* and could have easily failed silently instead (by implicitly using the wrong encoding on either side, or both sides).
Py2 was almost perfect for data processing. The strings were just bytes and encodings could be ignored, for the most part. That's how Go treats strings, btw.
And I have _never_ _ever_ had a case where Py3 strings helped me. Not once was I in a situation: "Wow! That string/bytes split saved the day for me, good job Python developers!"
