Re: [Python-ideas] Python octal escape character encoding "wats"

2018-11-10 Thread Richard Damon
On 11/9/18 11:19 PM, Steven D'Aprano wrote: > On Sat, Nov 10, 2018 at 12:56:07PM +1100, Chris Angelico wrote: > >> Not ambiguous. It takes as many valid octal digits as it can. > What is the rationale for that? Hex escapes don't. > > My guess is, "Because that's what C does". And C probably does it

Re: [Python-ideas] Python octal escape character encoding "wats"

2018-11-09 Thread Chris Angelico
On Sat, Nov 10, 2018 at 3:19 PM Steven D'Aprano wrote: > > On Sat, Nov 10, 2018 at 12:56:07PM +1100, Chris Angelico wrote: > > > Not ambiguous. It takes as many valid octal digits as it can. > > What is the rationale for that? Hex escapes don't. Irrelevant to whether it's ambiguous or not. > > "

Re: [Python-ideas] Python octal escape character encoding "wats"

2018-11-09 Thread Steven D'Aprano
On Sat, Nov 10, 2018 at 12:56:07PM +1100, Chris Angelico wrote: > Not ambiguous. It takes as many valid octal digits as it can. What is the rationale for that? Hex escapes don't. My guess is, "Because that's what C does". And C probably does it because "Dennis Ritchie wanted to minimize the num

Re: [Python-ideas] Python octal escape character encoding "wats"

2018-11-09 Thread Joao S. O. Bueno
On Fri, 9 Nov 2018 at 23:56, Chris Angelico wrote: > >>> list("\797") > ['\x07', '9', '7'] > The octal escape grabs as many digits as it can, and when it finds a > character in the literal that isn't a valid octal digit (same whether > it's a '9' or a 'q'), it stops. The remaining characters have

Re: [Python-ideas] Python octal escape character encoding "wats"

2018-11-09 Thread Chris Angelico
On Sat, Nov 10, 2018 at 12:42 PM Joao S. O. Bueno wrote: > > I just saw some document which reminded me that strings with a > backslash followed by 3 octal digits. When a backslash is followed by > 3 octal digits, that means a character with the corresponding > codepoint and all is well. > > The "

[Python-ideas] Python octal escape character encoding "wats"

2018-11-09 Thread Joao S. O. Bueno
I just saw some document which reminded me that strings with a backslash followed by 3 octal digits. When a backslash is followed by 3 octal digits, that means a character with the corresponding codepoint and all is well. The "valid scenaario": In [42]: "\777" Out[42]: 'ǿ' The problem is when yo