[IPython-dev] Re: [IPython-user] Feedback request on a new feature

Fernando Perez fperez at colorado.edu
Mon Dec 22 12:51:19 CST 2003

Prabhu Ramachandran wrote:
>>>>>>"FP" == Fernando Perez <fperez at colorado.edu> writes:
>     FP> Hi all, I'd like to solicit a bit of feedback from the
>     FP> community on a new feature.  I often get asked about a quick
>     FP> way to capture shell output to a python variable for further
>     FP> manipulation.  Granted, you can always do
> [snip]
>     FP> In [10]: $b=ls C*.py
> Yes, yes!  This would be useful.
> [snip]
>     FP> - It's not bloat, but a different syntax would be better, like
>     FP> !!b=ls *py
> That sounds good.  There's already '!ls' so !! is a natural extension.
> How about `ls`, i.e. back quotes?

I can't reuse back quotes, because they are already a python synonym for 
repr().  But !! might be a good thing: it has the advantage that if you do 
!something, and later want its output, you just need to up-arrow and add 
another ! character.  The implementation is a tad more involved than with a 
separate character ($), but it may be worth the added hassle once to keep the 
number of special syntaxes to a minimum.

>     FP> - Don't even print the output, it should just behave like
>     FP>   getoutput().  People
>     FP> can print out the variable if they need it (esp. useful if the
>     FP> output is potentially huge, but you want it trapped for
>     FP> processing).
> Yes, that sounds good.  For example if you want to read a file you
> would just do:
> a = `cat foo`
> or whatever (I am not sure if the above will be implementable or not).


> If you want to print it you can always do
> !cat foo
> So, I don't see why you'd want to print out the command.
>     FP> - You should split the output and return a list, since that's
>     FP>   what people will
>     FP> want most of the time.
> No, please, that sounds unPythonic to me.


Thanks for the feedback.  I'll give it a few days to hear back from people and 
will post a final draft of how to implement it.



ps: Prabhu, I think you are mailing from a different address than you 
originally subscribed from, because your mails to the list were bounced.  If 
you want, I can subscribe you from your new address.  Sorry, but the volume of 
spam was out of control, so I started blocking non-subscriber posts, and this 
may catch legitimate subscribers who use different addresses.

More information about the IPython-dev mailing list