You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary of the SO question: I have a large existing projects where people weren't thinking much about Unicode and happily mixing encoded strs and unicode together without thinking twice about telling the decoder what the encoding used is and what to do with byte sequences which can't be decoded. Apparently I'm not the only one with the problem if you do a SO search or search for the horrible hack I mentioned in the SO question.
Now it would be great if e.g. there was a mypy parameter with which all implicit conversions into unicode (which also means that the programmer didn't explicitly state any encoding) would raise a warning, including the examples from the SO post:
# potentially problematic cases if someStr can also have non-ASCII characters in itu"foo"+someStru"foo{}".format(someStr)
Note that I don't think that mypy should be making guesses about the content of the strings. Also, this RFE is probably related to #1141.
/edit: I just noticed that in python/typing#208 such solutions were already being discussed. Sorry for not noticing it earlier, think of this post here as an argument in favor of the strict approach then.
The text was updated successfully, but these errors were encountered:
Thanks! I think we have enough issues open for this topic already (you found both of them) so I'm going to close this one. We're going slowly here but I have a good hope that we'll end up in a good spot with support for your use case.
Uh oh!
There was an error while loading. Please reload this page.
What I'm looking look for is basically a solution to the following SO question concerning problematic implicit conversions into
unicode
(in Python 2, I guess in Python 3 the equivalent problem withbytes
tostring
conversions exists).Summary of the SO question: I have a large existing projects where people weren't thinking much about Unicode and happily mixing encoded
str
s andunicode
together without thinking twice about telling the decoder what the encoding used is and what to do with byte sequences which can't be decoded. Apparently I'm not the only one with the problem if you do a SO search or search for the horrible hack I mentioned in the SO question.Now it would be great if e.g. there was a mypy parameter with which all implicit conversions into unicode (which also means that the programmer didn't explicitly state any encoding) would raise a warning, including the examples from the SO post:
Note that I don't think that mypy should be making guesses about the content of the strings. Also, this RFE is probably related to #1141.
/edit: I just noticed that in python/typing#208 such solutions were already being discussed. Sorry for not noticing it earlier, think of this post here as an argument in favor of the strict approach then.
The text was updated successfully, but these errors were encountered: