[Python-ideas] Smoothing transition to Python 3

Stephen J. Turnbull stephen at xemacs.org
Sat Jun 4 12:36:55 EDT 2016


Re: mixing text and bytes: We have mixed bytes and text already (PEP
383 surrogate escape codecs), as well as a space-efficient
representation of text (PEP 393).  Python already has improved
versions of Emacs's facilities.

PEPs tl;dr version: Emacs's rawbytes representation is obnoxiously
expensive (minimum 4 bytes per "raw byte"), Python's half as much (PEP
383 surrogates).  PEP 393 gives 1-byte representation not only of pure
ASCII (as characters), but Latin-1 as well.  I'm not sure if Emacs
still implements the horrible as-unibyte APIs (which give you access
to the internal represention, guaranteeing you'll cause data
corruption, and sometimes even crashes), but they've long been
deprecated and I suppose Python 3 can do something similar with memory
views.  (It was never automatic in Emacs, and it was extremely
dangerous.)

As for the OPs other desiderata, they are all similarly bad ideas, and
they *won't help in porting* because Python 3 will never get them,
Guido has many times said so (except perhaps None as "bottom" in all
comparisons, which as far as I know hasn't been categorically rejected).

Steve



More information about the Python-ideas mailing list