Python under PowerShell adds characters

Marko Rauhamaa marko at pacujo.net
Thu Mar 30 00:29:48 EDT 2017


Steve D'Aprano <steve+python at pearwood.info>:

> On Thu, 30 Mar 2017 06:47 am, Marko Rauhamaa wrote:
>> Huh? The standard input is the workload 
>
> Which is usually typed by a human, read from a file containing
> human-readable text, a file-name intended to be read by a human, or
> some other data in human-readable form.

The main point is that it is supposed to be processed programmatically.
It is somewhat rare that you type in the standard input. In particular,
you want to be able to form useful pipelines from commands.

Of course, in grand UNIX tradition, you strive to design your
interchange formats to be also marginally applicable for human
interaction (XML, base64 etc).

>> and the standard output is the result of the computation.
> Which is generally intended to be read by a human.

That is more often the case. However, you want the format to be rigorous
so it can be easily parsed programmatically.

> Relatively few command-line computations are performed by machines,
> for machines, using machine-friendly human-hostile formats.

Didn't count them. Still, I'd expect not having to deal with Unicode
decoding exceptions with arbitrary input.

There recently was a related debate on the Guile mailing list. Like
Python3, Guile2 is sensitive to illegal UTF-8 on the command line and in
the standard streams. An emacs developer was urging Guile developers to
follow emacs's example and support a superset of UTF-8 and Unicode where
all byte strings can be bijectively mapped into text.

Python3 partially does a similar thing, but only when dealing with
pathnames.


Marko



More information about the Python-list mailing list