[Python-Dev] Re: What to do about invalid escape sequences

2019-08-12 Thread Greg Ewing
Eric V. Smith wrote: I'm not in any way serious about this. I just want people to realize how many wacky combinations there would be. It doesn't matter how many combinations there are, as long as multiple prefixes combine in the way you would expect, which they do as far as I can see. -- Greg

[Python-Dev] Raw string literals and trailing backslash

2019-08-12 Thread Serhiy Storchaka
Currently a raw literal cannot end in a single backslash (e.g. in r"C:\User\"). Although there are reasons for this. It is an old gotcha, and there are many closed issues about it. This question is even included in FAQ. The most common workarounds are: r"C:\User" "\\" and r"C:\User\

[Python-Dev] Re: What to do about invalid escape sequences

2019-08-12 Thread Serhiy Storchaka
11.08.19 23:07, Glenn Linderman пише: On 8/11/2019 1:26 AM, Serhiy Storchaka wrote: 10.08.19 22:10, Glenn Linderman пише: I wonder how many raw strings actually use the \"  escape productively? Maybe that should be deprecated too! ?  I can't think of a good and necessary use for it, can anyone

[Python-Dev] Re: typing: how to use names in result-tuples?

2019-08-12 Thread Ivan Levkivskyi
On Thu, 8 Aug 2019 at 17:17, Christian Tismer wrote: > Yes, that's what I mean. > Probably retval or whatever people prefer would be adequate, > with a special rule if that name is taken. > > I think btw. that using StructSequence(somename=sometype, ..., ) that > does a dict lookup is quite appea

[Python-Dev] Re: typing: how to use names in result-tuples?

2019-08-12 Thread Christian Tismer
On 12.08.19 10:52, Ivan Levkivskyi wrote: > On Thu, 8 Aug 2019 at 17:17, Christian Tismer > wrote: > > Yes, that's what I mean. > Probably retval or whatever people prefer would be adequate, > with a special rule if that name is taken. > > I think btw

[Python-Dev] Re: What to do about invalid escape sequences

2019-08-12 Thread Eric V. Smith
On 8/12/2019 2:52 AM, Greg Ewing wrote: Eric V. Smith wrote: I'm not in any way serious about this. I just want people to realize how many wacky combinations there would be. It doesn't matter how many combinations there are, as long as multiple prefixes combine in the way you would expect, whi

[Python-Dev] Re: typing: how to use names in result-tuples?

2019-08-12 Thread Ivan Levkivskyi
On Mon, 12 Aug 2019 at 11:24, Christian Tismer wrote: > On 12.08.19 10:52, Ivan Levkivskyi wrote: > > On Thu, 8 Aug 2019 at 17:17, Christian Tismer > > wrote: > > > > Yes, that's what I mean. > > Probably retval or whatever people prefer would be adequate, >

[Python-Dev] Re: What to do about invalid escape sequences

2019-08-12 Thread Steve Dower
On 10Aug2019 1544, Glenn Linderman wrote: On 8/10/2019 3:36 PM, Greg Ewing wrote: It might be better to introduce a new string prefix, e.g. 'v' for 'verbatim':    v"C:\Users\Fred\" Which is why I suggested  rr"C:\directory\", but allowed as how there might be better spellings I like your 

[Python-Dev] Re: What to do about invalid escape sequences

2019-08-12 Thread Terry Reedy
On 8/8/2019 5:31 AM, Dima Tisnek wrote: These two ought to be converted to raw strings, shouldn't they? For the first example, yes or no. It depends ;-) See below. The problem is that string literals in python code are, by default, half-baked. The interpretation of '\' by the python parser,

[Python-Dev] Re: What to do about invalid escape sequences

2019-08-12 Thread Steve Holden
On Mon, Aug 12, 2019 at 6:26 PM Terry Reedy wrote: > On 8/8/2019 5:31 AM, Dima Tisnek wrote: > [...] > > To me, this one of the major problems with the half-baked default. > People who want string literals left as is sometimes get away with > omitting explicit mention of that fact, but sometimes

[Python-Dev] Re: What to do about invalid escape sequences

2019-08-12 Thread Terry Reedy
On 8/7/2019 6:57 PM, raymond.hettin...@gmail.com wrote: For me, these warnings are continuing to arise almost daily. See two recent examples below. Both examples are fragile, as explained below. They make me more in favor of no longer guessing what \ means in the default mode. The transit

[Python-Dev] Re: What to do about invalid escape sequences

2019-08-12 Thread Terry Reedy
On 8/12/2019 6:34 AM, Eric V. Smith wrote: On 8/12/2019 2:52 AM, Greg Ewing wrote: Eric V. Smith wrote: I'm not in any way serious about this. I just want people to realize how many wacky combinations there would be. It doesn't matter how many combinations there are, as long as multiple prefi

[Python-Dev] Re: Raw string literals and trailing backslash

2019-08-12 Thread Glenn Linderman
On 8/12/2019 12:08 AM, Serhiy Storchaka wrote: Currently a raw literal cannot end in a single backslash (e.g. in r"C:\User\"). Although there are reasons for this. It is an old gotcha, and there are many closed issues about it. This question is even included in FAQ. Hmm. I didn't find it docu

[Python-Dev] Re: What to do about invalid escape sequences

2019-08-12 Thread Glenn Linderman
On 8/12/2019 12:11 AM, Serhiy Storchaka wrote: 11.08.19 23:07, Glenn Linderman пише: On 8/11/2019 1:26 AM, Serhiy Storchaka wrote: 10.08.19 22:10, Glenn Linderman пише: I wonder how many raw strings actually use the \"  escape productively? Maybe that should be deprecated too! ?  I can't think

[Python-Dev] Re: What to do about invalid escape sequences

2019-08-12 Thread Neil Schemenauer
On 2019-08-10, Serhiy Storchaka wrote: > Actually we need to distinguish the the author and the user of the code and > show warnings only to the author. Using .pyc files was just an heuristic: > the author compiles the Python code, and the user uses compiled .pyc files. > Would be nice to have more

[Python-Dev] Inline links in Misc/NEWS entries

2019-08-12 Thread Kyle Stanley
Recently, on Discuss, I created a new topic: https://discuss.python.org/t/should-news-entries-contain-documentation-links/2127 However, many may not have the time to read the full post or don’t regularly check the core workflow category on Discuss, so I'll provide a shortened version here. Dur

[Python-Dev] Re: Raw string literals and trailing backslash

2019-08-12 Thread Serhiy Storchaka
12.08.19 22:41, Glenn Linderman пише: On 8/12/2019 12:08 AM, Serhiy Storchaka wrote: Currently a raw literal cannot end in a single backslash (e.g. in r"C:\User\"). Although there are reasons for this. It is an old gotcha, and there are many closed issues about it. This question is even includ

[Python-Dev] Re: What to do about invalid escape sequences

2019-08-12 Thread Serhiy Storchaka
12.08.19 22:51, Glenn Linderman пише: On 8/12/2019 12:11 AM, Serhiy Storchaka wrote: For example, in many cases `\"` can be replaced with `"'"'r"`, but it does not look pretty readable. No, that is not readable.  But neither does it seem to be valid syntax, or else I'm not sure what you are s

[Python-Dev] Re: Raw string literals and trailing backslash

2019-08-12 Thread Glenn Linderman
On 8/12/2019 10:21 PM, Serhiy Storchaka wrote: 12.08.19 22:41, Glenn Linderman пише: On 8/12/2019 12:08 AM, Serhiy Storchaka wrote: Currently a raw literal cannot end in a single backslash (e.g. in r"C:\User\"). Although there are reasons for this. It is an old gotcha, and there are many close

[Python-Dev] Re: Inline links in Misc/NEWS entries

2019-08-12 Thread Mariatta
> I would like to understand why some developers dislike including it, even when the reST syntax is provided. This has something to do with the use of blurb/blurb-it. Both tools specifically say "single paragraph with simple ReST markup". Further reading blurb's source code, it says the format of