osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Python 3.2 has some deadly infection


On Thu, Jun 5, 2014 at 10:17 AM, Robin Becker <robin at reportlab.com> wrote:
> in python 2 str and unicode were much more comparable. On balance I think
> just reversing them ie str --> bytes and unicode --> str was probably the
> right thing to do if the default conversions had been turned off. However
> making bytes a crippled thing was wrong.

How should e.g. bytes.upper() be implemented then?  The correct
behavior is entirely dependent on the encoding.  Python 2 just assumes
ASCII, which at best will correctly upper-case some subset of the
string and leave the rest unchanged, and at worst could corrupt the
string entirely.  There are some things that were dropped that should
not have been, but my impression is that those are being worked on,
for example % formatting in PEP 461.