[IPython-user] More Windows questions part 2 - \/ characters revisited

Ville Vainio vivainio at gmail.com
Fri Aug 12 08:05:32 CDT 2005


A little blast from the past:

On 6/22/05, Jerry McRae <qrs0xyc02 at sneakemail.com> wrote:

> #3. And while I agree \ as an escape character is necessary, IPython is
> a command interpreter.  I think IPython should be reading raw strings
> as its commands.  I know I will have to live with using \ when

There was a disagreement about this a while ago, but there is a
compromise that should at least be considered: when prefixed with !,
ipython should definitely escape the backslashes when converting the
command:

[C:\]|12> !dir c:\
--------------------------------------------------------
   File "<console>", line 1
     __IP.system("dir c:\")
                          ^
SyntaxError: EOL while scanning single-quoted string

Or perhaps more correctly convert it to __IP.system(r"dir c:\")
(i.e. raw string)

And I don't really see a reason to not use raw string for aliases and
magics either ATM. So I'm still strongly -1 for using backslash
(os.sep) in line completion, but +1 for switching to raw strings for
aliases, system (!) and magics. So bacslashes would work, but they
would not be inserted by the completer in filenames.

And yes, i can contribute code & testing on win32 too, but the change
could most easily be tried by Fernando I guess (because if if works on
linux, it will work on windows - the completer would not be touched).
Jerry, still interested?




More information about the IPython-user mailing list