[Python-ideas] Normalized Python

anatoly techtonik techtonik at gmail.com
Wed Jan 29 10:11:44 CET 2014


Python is a cross-platform language, but I often find myself writing
sections specific for Windows and for Linux and sometimes even OS
setting specific code. In these moments I that Python is not more
cross-platform that C, for example.

What could be done?


Normalized Python - a set of default, standard behaviors that backup
common user expectations about cross-platform and system-independent
behavior regardless of backward compatibility and code compatibility
concerns.


This is needed, for example, to collect these two features:
1. open files in binary mode by default
why?
    because "text file" is a human abstraction, for operating
    system it is just another format of binary data, so default
    operation is to read this data without any preprocessing

2. open text files in utf-8 encoding
why?
    because users can not know the encoding of operating
    system, their programs can not choose right encoding,
    therefore a best guess is to expect the most widely used
    standard

3. threat stdout/stdin streams as binary
why?
    because you don't want you data to be corrupt when
    you pass it in and out of Python via standard streams


Having a separate "Normalized Python" concept is needed to set
the context for developing and engineering ideas, instead of
concentrating on the sad reality of backward compatibility curse.
-- 
anatoly t.


More information about the Python-ideas mailing list