benrg <benrud...@gmail.com> added the comment:

This issue should be marked dependent on issue 43702 or issue 46862, since 
fixing it could break third-party code unless they're fixed first.


> Given 'nt.environ' is available without case remapping, I think that's the 
> best workaround.

Right now, it's not a good workaround because it contains the environment at 
the time the interpreter was started, not the current environment. On Posix, 
_Environ takes a reference to posix.environ and uses it directly, so it does 
get updated. On Windows, _Environ gets a rewritten dictionary and nt.environ is 
just a space-wasting attractive nuisance. I think it should be replaced with 
getenviron() which builds a dict from the environment block each time it's 
called. But posix.environ is documented (though nt.environ isn't), so maybe not.


> class _CaseInsensitiveString(str):

I think there should be a public class like this. It could be useful to 
email.message.Message and its clients like urllib. They currently store headers 
in a list and every operation is O(n).

The semantics are tricky. As written, it violates the requirement that equal 
objects have equal hashes. To fix that, you'd have to make every CIS compare 
unequal to every str. At that point, it probably shouldn't be a str subclass, 
which also has the advantage that it's not limited to strings. It can be a 
generic compare-by-key wrapper.

----------
nosy: +benrg

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue28824>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to