David Hopwood schrieb:
>> The PEP doesn't deal with streams. It is about files.
> 
> An important part of the Unix design philosophy (partially adopted by Windows)
> is to make streams and files behave as similarly as possible. It is quite
> feasible to make *some* detection algorithms work for streams, and this is
> an advantage over algorithms that don't work for streams.

There is nothing wrong with that principle. But it's just a principle.
Depending on the kind of stream, different technologies for detecting
the encoding are necessary. For example, on a Win32 terminal, a special
API is available to determine the encoding. On a Unix interactive
terminal, the locale's encoding should be assumed (and more so than for
regular files: for a file, the user may chose a different encoding;
for the console, the encoding is close to (sic) a hardware setting that
cannot be changed).

The Unix principle is often extended to reach into areas where it really
becomes inadequate, look at Plan 9 for an example. Wrt. byte streams
and encodings, the principle works only if all applications use the
same encoding (which they do on Plan 9).

Regards,
Martin
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to