Using Python 2
Grant Edwards
grant.b.edwards at gmail.com
Fri Sep 8 12:56:45 EDT 2017
On 2017-09-08, Steve D'Aprano <steve+python at pearwood.info> wrote:
> One thing which is notoriously tricky to migrate is mixed
> bytes/Latin1 text using Python 2 strings, say you're manipulating
> file formats that mix text with binary bytes. These mixed
> binary/text files are sometimes badly suited to the new
> Unicode/bytes model.
Definitely. I maintain a lot of apps that do low-level serial and
network protocol stuff, and porting them to 3 is sometimes painful.
The equivalence of text and bytes in 2.7 meant that there was often an
easy, obvious way to do things that can't be readily translated into
Python 3.
Even writing 2/3 compatible code from scratch isn't easy, since the
'bytes' type in 2 is way different than the 'bytes' type in 3. If
only Python 2 had 'from future import bytes'...
In hindsite, I probably should have sat down years ago and written a
'bytes' class for Python2 that would be compatible with Python3.
--
Grant Edwards grant.b.edwards Yow! Uh-oh!! I forgot
at to submit to COMPULSORY
gmail.com URINALYSIS!
More information about the Python-list
mailing list