Python 3.2 has some deadly infection

Tim Delaney timothy.c.delaney at gmail.com
Mon Jun 2 05:02:16 EDT 2014


On 2 June 2014 17:45, Wolfgang Maier <
wolfgang.maier at biologie.uni-freiburg.de> wrote:

> Tim Delaney <timothy.c.delaney <at> gmail.com> writes:
>
> > For some purposes, there needs to be a way to treat an arbitrary stream
> of
> bytes as an arbitrary stream of 8-bit characters. iso-latin-1 is a
> convenient way to do that.
> >
>
> For that purpose, Python3 has the bytes() type. Read the data as is, then
> decode it to a string once you figured out its encoding.
>

I know that, you know that. Convincing other people of that is the
difficulty.

I probably should have mentioned it, but in my case it's not even Python
(Java). It's exactly the same principal - an assumption was made that has
become entrenched due to the fear of breakage. If they'd been forced to
think about encodings up-front, it shouldn't have been an issue, which was
the point I was trying to make.

In Java, it's much worse. At least with Python you can perform string-like
operations on bytes. In Java you have to convert it to characters before
you can really do anything with it, so people just use the default encoding
all the time - especially if they want the convenience of line-by-line
reading using BufferedReader ...

Tim Delaney
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20140602/eec8f452/attachment.html>


More information about the Python-list mailing list