Path: csiph.com!usenet.pasdenom.info!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'defaults': 0.07; 'ignored': 0.07; 'parser': 0.07; 'literal': 0.09; 'strings.': 0.09; 'trailing': 0.09; 'subject:How': 0.10; 'bug': 0.12; '-tkc': 0.16; 'backslash': 0.16; 'backslash,': 0.16; 'expands': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'literals.': 0.16; 'parser.': 0.16; 'subject:mirror': 0.16; 'unescaped': 0.16; 'wrote:': 0.18; "python's": 0.19; 'putting': 0.22; 'purposes': 0.26; 'primary': 0.26; 'header:In-Reply-To:1': 0.27; '(this': 0.29; "doesn't": 0.30; "d'aprano": 0.31; 'steven': 0.31; 'file': 0.32; 'raw': 0.33; 'noticed': 0.34; "i'd": 0.34; 'could': 0.34; 'subject:with': 0.35; "can't": 0.35; 'charset:us-ascii': 0.36; 'two': 0.37; 'starting': 0.37; 'to:addr:python-list': 0.38; 'quote': 0.39; 'to:addr:python.org': 0.39; 'remove': 0.60; 'matter': 0.61; 'first': 0.61; 'real': 0.63; 'day.': 0.63; 'close': 0.67; 'nobody': 0.68; 'sound': 0.68; 'subjectcharset:utf-8': 0.72; 'end.': 0.84; 'received:50.22': 0.84 Date: Tue, 3 Sep 2013 05:31:59 -0500 From: Tim Chase To: python-list@python.org Subject: Re: How to split with "\" character, and licence copyleft mirror of =?UTF-8?B?wqk=?= In-Reply-To: <5225443e$0$6599$c3e8da3$5496439d@news.astraweb.com> References: <5225443e$0$6599$c3e8da3$5496439d@news.astraweb.com> X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - boston.accountservergroup.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tim.thechases.com X-Get-Message-Sender-Via: boston.accountservergroup.com: none X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 29 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1378204256 news.xs4all.nl 15892 [2001:888:2000:d::a6]:60744 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:53562 On 2013-09-03 02:06, Steven D'Aprano wrote: >> So the real bug is with the parser. > > It is likely that nobody noticed this bug in the first place > because the current behaviour doesn't matter for regexes, which is > the primary purpose of raw strings. You can't end a regex with an > unescaped backslash, so r'abc\'' is an illegal regex and it doesn't > matter if you can't create it. I'd contend that the two primary purposes of raw strings (this is starting to sound like a Spanish Inquisition sketch) are regexes and DOS/Win32 file path literals. And I hit this trailing-backslash case all the time, as Vim's path-completion defaults to putting the trailing backslash at the end. So I might be entering a literal like r"c:\win and hit which expands to r"c:\Windows\ for which I then need to both remove the backslash and close the quote. If Python's parser just blithely ignored terminal backslashes, I could just close the quote and get on with my day. -tkc