[Python-ideas] Infix functions

Stephen J. Turnbull stephen at xemacs.org
Mon Feb 24 01:45:36 CET 2014


Please read to the end before responding.  I don't know how to write
this without sounding hostile toward Windows ... I am.  But I'm not
hostile toward programmers who develop in Windows!  Bear with me.

Paul Moore writes:

 > 1. The Windows console is not Unicode-friendly and displaying
 > non-ASCII source code is still problematic.

And there's no IDE (IDLE? but ISTR tkinter breaks on Windows :-( ) or
similar that provides a simple Unicode-capable console you can run
Python in?  AFAIK the Emacs console emulations work fine on Windows
(but I haven't tried Python in them).  I don't know if Windows shells
like Emacs very much (although Emacs does provide a shell written
directly in Lisp, so you can circumvent the Windows console and shell
completely).

 > 2. Encoding detection is *not* a solved problem, and it's certainly
 > not universally implemented in editors.

I don't understand how this is related.  Encoding detection for Python
source *is* a solved problem in Python, since PEP 263.  I don't really
understand why the fact that it's not implemented in *your* editor
should be anybody else's problem: Emacs on Windows has been capable
(with a patch) since ~1991 (and without a patch since ~1998), due to
the fact that PEP 263 coding cookies were modeled after the popular
Emacs/vi cookies.

 > 3. Tools like grep may or may not work with extended characters

Of course they do; all the usual stream-oriented Unix tools work fine.
It's trivial due to the traditional restriction of tool languages to
ASCII and the use of ASCII-compatible encodings.  You do need to make
sure that any tool arguments (such as regexps) use the same encoding
as the stream to be processed (but I suppose that goes without
saying).

So if you're seeing wierdness, either arguments don't match stream
(which often would be due to a console issue) or the console can't
input/display the characters correctly.

 > But it does mean that Andrew Barnert's comment "in the far off day
 > that Python and source editors could handle Unicode.  And we have
 > pretty much reached that day." may not be true unless you're
 > willing to ignore Windows users.

Andrew's comment is *precisely* true: Python loves Unicode, and
Notepad handles UTF-8 fine.  I would imagine any real source editor on
Windows does too.

So your point comes down to "the Windows console sucks and I don't
like Emacs".  OK, that's a valid concern -- there are an awful lot of
developers for whom the Windows console is an essential component of
their environments, and Emacs is more than an acquired taste, it's a
different way of seeing the world.

But how many more decades is the Windows console going to be allowed
to hold back the rest of the world?  If it hasn't learned Unicode by
now, is there any reason to suppose it ever will?  If it won't learn,
why not bite the bullet now?  There are fewer Windows programmers to
feel pain now than there ever will be again (we hope :-)!



More information about the Python-ideas mailing list