[Python-ideas] Make non-meaningful backslashes illegal in string literals
Chris Angelico
rosuav at gmail.com
Fri Aug 7 15:12:05 CEST 2015
On Fri, Aug 7, 2015 at 11:03 PM, Wes Turner <wes.turner at gmail.com> wrote:
> So this doesn't work?
>
> path = pathilb.Path(u"c:\users")
> # SEC: path concatenation is often in conjunction with user-supplied
> input
If you try it, you'll see. You get an instant SyntaxError, because \u
introduces a Unicode codepoint (eg \u0303) in a Unicode string. In a
bytes string, it's meaningless, and therefore is the same thing as
"\\u".
ChrisA
More information about the Python-ideas
mailing list