[IPython-dev] pydb 1.19 released, thoughts about integration

Fernando Perez fperez.net at gmail.com
Fri Oct 27 16:53:22 EDT 2006


On 10/27/06, Ville M. Vainio <vivainio at gmail.com> wrote:

> shlex.split helps here:
>
> [ipython]|4> shlex.split('hello world "and good luck"')
>          <4> ['hello', 'world', 'and good luck']

You can use genutils.arg_split() from SVN r.1845 (I just committed
it).  It's a thin shlex.split wrapper, but it lets you keep your
quotes nicely in case you need them:

In [3]: genutils.arg_split('hello world "and good luck"')
Out[3]: ['hello', 'world', '"and good luck"']

In [4]: genutils.arg_split('hello world "and good luck"',posix=True)
Out[4]: ['hello', 'world', 'and good luck']

The first case is needed if you want a magic that sees the original
strings as single units (which we need in magics to extract the
magic's command line flags while preserving the original strings for
the downstream program).

Cheers,

f



More information about the IPython-dev mailing list