[IPython-user] Inconsistency in "!!" ?

Walter Dörwald walter at livinglogic.de
Fri Jun 23 13:08:47 CDT 2006


Krishna Mohan Gundu wrote:

> Hi Walter,
> 
>> Actually it isn't, it's a (deprecated) way of writing repr():
>>
>> In [1]: `"foo"`
>> Out[1]: "'foo'"
> 
> mmm...

But as it's deprecated, I hope that it will go away in Python 3000, so
we could use it.

>> Why not use plain Python syntax?
>>
>>     foo = `"string" ls`
>>
>> isn't that much shorter than
>>
>>     foo = ipstring("ls")
> 
> we could do that too and I agree it reads well
> 
>> Of course `ls` (without keyword) is hard to beat, but typing ` on a
>> german keyboard is cumbersome.
> 
> then what is used in shell scripting, for example,
> for file in `ls`
> ...

I won't try to suggest that bash should be changed! ;)

>> 2/3rds of what you want is rather simple (albeit a bit longer) with
>> ipipe:
>>
>> In [2]: foo = list(ix("ls"))
> 
> does ix support variable substitution?

It doesn't (except for
In [2]: foo = list(ix("ls %s" % "foo"))

Servus,
   Walter




More information about the IPython-user mailing list