Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #53562

Re: How to split with "\" character, and licence copyleft mirror of ©

Date 2013-09-03 05:31 -0500
From Tim Chase <python.list@tim.thechases.com>
Subject Re: How to split with "\" character, and licence copyleft mirror of ©
References <c795fae4-2b38-4d81-a552-a69febdac0c0@googlegroups.com> <r4u729t37qllb5dfcc7qmq5hpsi8apl6gf@4ax.com> <mailman.513.1378154810.19984.python-list@python.org> <5225443e$0$6599$c3e8da3$5496439d@news.astraweb.com>
Newsgroups comp.lang.python
Message-ID <mailman.1.1378204256.5461.python-list@python.org> (permalink)

Show all headers | View raw


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 <tab> 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


Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

How to split with "\" character, and licence copyleft mirror of © materile11@gmail.com - 2013-09-01 17:03 -0700
  Re: How to split with "\" character, and licence copyleft mirror of © Cameron Simpson <cs@zip.com.au> - 2013-09-02 10:23 +1000
  Re: How to split with "\" character, and licence copyleft mirror of © Tim Chase <python.list@tim.thechases.com> - 2013-09-01 19:34 -0500
    Re: How to split with "\" character, and licence copyleft mirror of © materile11@gmail.com - 2013-09-01 21:20 -0700
  Re: How to split with "\" character, and licence copyleft mirror of © Tim Chase <python.list@tim.thechases.com> - 2013-09-01 19:40 -0500
  Re: How to split with "\" character, and licence copyleft mirror of © Tim Roberts <timr@probo.com> - 2013-09-01 19:40 -0700
    Re: How to split with "\" character, and licence copyleft mirror of © Ethan Furman <ethan@stoneleaf.us> - 2013-09-02 13:22 -0700
      Re: How to split with "\" character, and licence copyleft mirror of © Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-09-03 02:06 +0000
        Re: How to split with "\" character, and licence copyleft mirror of © Tim Chase <python.list@tim.thechases.com> - 2013-09-03 05:31 -0500
        Re: How to split with "\" character, and licence copyleft mirror of © random832@fastmail.us - 2013-09-03 14:31 -0400
          Re: How to split with "\" character, and licence copyleft mirror of © Tim Roberts <timr@probo.com> - 2013-09-05 20:33 -0700
            Re: How to split with "\" character, and licence copyleft mirror of � Terry Reedy <tjreedy@udel.edu> - 2013-09-06 02:15 -0400
            Re: How to split with "\" character, and licence copyleft mirror of © random832@fastmail.us - 2013-09-06 09:29 -0400
            Re: How to split with "\" character, and licence copyleft mirror of � Fábio Santos <fabiosantosart@gmail.com> - 2013-09-11 11:16 +0100

csiph-web