Re: what is wrong with that r"\"

2007-07-08 Thread samwyse
On Jul 4, 7:15 am, Matthieu TC <[EMAIL PROTECTED]> wrote: > May I suggest giving the possibility to use any delimiter for a raw string? > just like in Vi or ruby. > > Vi: > %s_a_b_g is valid and so is %s/a/b/g > > Ruby: > %q{dj'\ks'a\'"} or %q-dj'\ks'a\'"- > > So as long as your regex does

Re: what is wrong with that r"\"

2007-07-08 Thread jimxu
Yeah, that's a good point... On Jul 8, 2007, at 1:48 AM, Tim Roberts wrote: > i3dmaster <[EMAIL PROTECTED]> wrote: >> >> Then you can use other chars as the delimiter, [EMAIL PROTECTED]@b@ or >> r!a!b!, >> etc... The import thing is so long as the interpreter doesn't get >> confused on the data

Re: what is wrong with that r"\"

2007-07-07 Thread Tim Roberts
i3dmaster <[EMAIL PROTECTED]> wrote: > >Then you can use other chars as the delimiter, [EMAIL PROTECTED]@b@ or r!a!b!, > >etc... The import thing is so long as the interpreter doesn't get >confused on the data and the delimiter. That limits the number of valid delimiters to a relatively small

Re: what is wrong with that r"\"

2007-07-06 Thread i3dmaster
Then you can use other chars as the delimiter, [EMAIL PROTECTED]@b@ or r!a!b!, etc... The import thing is so long as the interpreter doesn't get confused on the data and the delimiter. sed also allows for arbitrary delimiters too as long as you maintain the integrity of the original meanin

Re: what is wrong with that r"\"

2007-07-05 Thread Tim Roberts
Matthieu TC <[EMAIL PROTECTED]> wrote: >May I suggest giving the possibility to use any delimiter for a raw string? >just like in Vi or ruby. > >Vi: > %s_a_b_g is valid and so is %s/a/b/g > >Ruby: > %q{dj'\ks'a\'"} or %q-dj'\ks'a\'"- > >So as long as your regex does not use all the valid cha

Re: what is wrong with that r"\"

2007-07-05 Thread Nick Craig-Wood
Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Wed, 04 Jul 2007 11:21:14 +, Neil Cerutti wrote: > > > If the escaped quotes didn't function in raw strings, I'd be > > unable to construct (with a single notation) a regex that > > included both kinds of quotes at once. > > > > re.c

Re: what is wrong with that r"\"

2007-07-04 Thread Neil Cerutti
On 2007-07-04, Neil Cerutti <[EMAIL PROTECTED]> wrote: > On 2007-07-04, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: >> On Wed, 04 Jul 2007 11:21:14 +, Neil Cerutti wrote: >> >>> If the escaped quotes didn't function in raw strings, I'd be >>> unable to construct (with a single notation)

Re: what is wrong with that r"\"

2007-07-04 Thread Neil Cerutti
On 2007-07-04, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Wed, 04 Jul 2007 11:21:14 +, Neil Cerutti wrote: > >> If the escaped quotes didn't function in raw strings, I'd be >> unable to construct (with a single notation) a regex that >> included both kinds of quotes at once. >> >

Re: what is wrong with that r"\"

2007-07-04 Thread Steve Holden
Matthieu TC wrote: > May I suggest giving the possibility to use any delimiter for a raw string? > just like in Vi or ruby. > Of course you may. Thank you for your suggestion. Now, on to other business. regards Steve -- Steve Holden+1 571 484 6266 +1 800 494 3119 Holden Web LLC/Lt

Re: what is wrong with that r"\"

2007-07-04 Thread Matthieu TC
cters, readability is maintained. -matt - Original Message From: Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> To: python-list@python.org Sent: Wednesday, July 4, 2007 9:27:46 PM Subject: Re: what is wrong with that r"\" On Wed, 04 Jul 2007 11:21:14 +, Neil Ceru

Re: what is wrong with that r"\"

2007-07-04 Thread Duncan Booth
Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > Does anyone know the justification for a)? Maybe we should remove it > in py3k? > I think at least part of the justification is that it keeps the grammar simple. The tokenising happens identically irrespective of any modifiers. The r modifier doesn

Re: what is wrong with that r"\"

2007-07-04 Thread Marc 'BlackJack' Rintsch
On Wed, 04 Jul 2007 11:21:14 +, Neil Cerutti wrote: > If the escaped quotes didn't function in raw strings, I'd be > unable to construct (with a single notation) a regex that > included both kinds of quotes at once. > > re.compile(r"'\"") Where's the problem!? :: re.compile(r"''')

Re: what is wrong with that r"\"

2007-07-04 Thread Neil Cerutti
On 2007-07-04, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: >> String quotes can be escaped with a backslash, but the >> backslash remains in the string; for example, r"\"" is a >> valid string literal consisting of two characters: a >> backslash and a double quote; > > a) That is wei

Re: what is wrong with that r"\"

2007-07-04 Thread Nick Craig-Wood
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > On Jul 3, 7:15 am, alf <[EMAIL PROTECTED]> wrote: > > question without words: > > > > >>> r"\" > >File "", line 1 > > r"\" > > ^ > > SyntaxError: EOL while scanning single-quoted string > > >>> r"\ " > > '\\ ' > > One slash escape

Re: what is wrong with that r"\"

2007-07-04 Thread Nick Craig-Wood
Neil Cerutti <[EMAIL PROTECTED]> wrote: > From the Python Language Reference 2.4.1 String Literals: > > When an "r" or "R" prefix is present, a character following a > backslash is included in the string without change, and all > backslashes are left in the string. For example, the st

Re: what is wrong with that r"\"

2007-07-03 Thread Neil Cerutti
On 2007-07-03, alf <[EMAIL PROTECTED]> wrote: > question without words: > > >>> r"\" >File "", line 1 > r"\" > ^ > SyntaxError: EOL while scanning single-quoted string > >>> r"\ " > '\\ ' >From the Python Language Reference 2.4.1 String Literals: When an "r" or "R" prefix is p

Re: what is wrong with that r"\"

2007-07-03 Thread kyosohma
On Jul 3, 8:25 am, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > On Tue, 03 Jul 2007 06:16:43 -0700, [EMAIL PROTECTED] wrote: > >On Jul 3, 7:15 am, alf <[EMAIL PROTECTED]> wrote: > >> question without words: > > >> >>> r"\" > >>File "", line 1 > >> r"\" > >> ^ > >> SyntaxError:

Re: what is wrong with that r"\"

2007-07-03 Thread Jean-Paul Calderone
On Tue, 03 Jul 2007 06:16:43 -0700, [EMAIL PROTECTED] wrote: >On Jul 3, 7:15 am, alf <[EMAIL PROTECTED]> wrote: >> question without words: >> >> >>> r"\" >>File "", line 1 >> r"\" >> ^ >> SyntaxError: EOL while scanning single-quoted string >> >>> r"\ " >> '\\ ' > >One slash esca

Re: what is wrong with that r"\"

2007-07-03 Thread kyosohma
On Jul 3, 7:15 am, alf <[EMAIL PROTECTED]> wrote: > question without words: > > >>> r"\" >File "", line 1 > r"\" > ^ > SyntaxError: EOL while scanning single-quoted string > >>> r"\ " > '\\ ' One slash escapes the following character, so the proper way of writing it is either r

what is wrong with that r"\"

2007-07-03 Thread alf
question without words: >>> r"\" File "", line 1 r"\" ^ SyntaxError: EOL while scanning single-quoted string >>> r"\ " '\\ ' -- http://mail.python.org/mailman/listinfo/python-list