This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients a.badger, loewis, vstinner
Date 2008-11-24.10:19:36
SpamBayes Score 5.1189257e-09
Marked as misclassified No
Message-id <>
In-reply-to <>
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 

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

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 :-/
Date User Action Args
2008-11-24 10:19:39vstinnersetrecipients: + vstinner, loewis, a.badger
2008-11-24 10:19:38vstinnerlinkissue4006 messages
2008-11-24 10:19:37vstinnercreate