[Python-Dev] Python-3.0, unicode, and os.environ

Nick Coghlan ncoghlan at gmail.com
Sun Dec 7 02:12:24 CET 2008


Toshio Kuratomi wrote:
> Note 2: If there isn't a parallel API on all platforms, for instance,
> Guido's proposal to not have os.environb on Windows, then you'll still
> have to have a platform specific check. (Likely you should try to access
> os.evironb in this instance and if it doesn't exist, use os.environ
> instead... and remember that you need to either change os.environ's data
> into str type or change os.environb's data into byte type.)

Note that this is why I personally think the binary API variants
*should* exist on Windows, just with the sense of the system encoding
flipped around.

That is, on *nix:
- underlying OS API uses bytes
- binary API just passes values straight through
- Unicode API uses the system encoding to encode Unicode names and
values to be passed to the OS API and to decode bytes names and values
received from the OS API

While on Windows:
- underlying OS API uses Unicode
- Unicode API just passes values straight through
- binary API uses the system encoding to decode bytes names and values
to be passed to the OS API and to encode Unicode names and values
received from the OS API

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------


More information about the Python-Dev mailing list