I agree with the numerous posters who have brought up the 
backward-compatibility concern. This change *would* break lots of code. At the 
same time, this bites me consistently, so I'd like to do something soon... at 
least sooner than 6.0 ;).

I believe that this is better solved by static analysis. I suggested some time 
ago on typing-sig that we explore adding a `Chr` type to typing, and type `str` 
as a `Sequence[Chr]` rather than a `Sequence[str]`. You can read the proposal 
here (it's not very complex at all, and should be backward-compatible for all 
but the hairiest cases, which just need either a cast or an annotation):

https://mail.python.org/archives/list/typing-...@python.org/thread/OLCQHSNCLM2TOHRQWB3WPSI66AA5A3G7

With it, we have a path forward where type-checkers like mypy assure us that 
we're really doing what we think we're doing with that string, and require 
explicit annotations or casts for the ambiguous cases. That discussion fizzled 
out, but I'm still very much interested in exploring the idea if it seems like 
a realistic alternative. I think it makes much more sense than changing the 
mostly-sensible, well-known, often-used runtime behavior of strings.

Brandt
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/IZAH5AJBPZWEZKCORAZGQ6QZZRGMC2WT/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to