STINNER Victor <[EMAIL PROTECTED]> added the comment: The bug tracker is maybe not the right place to discuss a new Python3 feature.
> 1) return mixed unicode and byte types in os.environ One goal of Python3 was to avoid mixing bytes and characters (bytes/str). > 2) return only byte types in os.environ os.environ contains text (characters) and so should decoded as unicode. > 3) raise an exception if someone attempts to access an environment > variable that cannot be decoded to unicode via the system encoding and > allow the value to be accessed as a byte string via another method. > 4) silently ignore the non-decodable variables when accessing os.environ > the normal way but have another method of accessing it that returns all > values as byte strings. Why not for (3). But what would be the "another method" (4) to access byte string? The problem of having two methods is that you need consistent objects. Imagine that you have os.environ (unicode) and os.environb (bytes). Example 1: os.environb['PATH'] = b'\xff\xff\xff\xff' What is the value in os.environ['PATH']? Example 2: os.environb['PATH'] = b'têst' What is the value in os.environ['PATH']? Example 3: os.environ['PATH'] = 'têst' What is the value in os.environb['PATH']? Example 4: should I use os.environ['PATH'] or os.environb['PATH'] to get the current PATH? It introduces many new cases (bugs?) that have to be prepared and tested. If you are motivated, you can contribute by a patch to test your ideas ;-) I'm interrested by os.environb, but as I wrote, I expect new complex problems :-/ _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue4006> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com