[IPython-dev] (no subject)

Andrew Payne andy at payne.org
Thu Jul 10 12:55:14 EDT 2014


Following up on the shell discussion:

A detailed proposal is at
>
> https://raw.githubusercontent.com/sjdv1982/ipython/master/docs/source/whatsnew/pr/incompat-bangmode.rst
> All of the examples in the proposal are working with the code branch.
>

Reading your issues and proposals, my design advice (as an IPython user)
would be to consolidate them into a new custom magic, based on the existing
%sx (!), that performs the way you want.  See the source here:
https://github.com/ipython/ipython/blob/master/IPython/core/magics/osm.py

You could do shell-compatible variable expansion, etc.  For the idea of
having Python functions participate in the pipeline (e.g. your "%bless"
magic), you could:

   1. For each pipeline stage, first look for a Python function of the name
   and use it if it exists (aggressive, could have surprising name collisions),
   2. Have a safe character prefix that indicates a Python function call vs
   a exec process invocation, OR,
   3. Have a decorator (e.g. @mkpipe) that marks a Python function as being
   a pipe function

I agree with the previous comments:  the style of using Unix pipes and
commands (esp. intermixed with Python) is probably off to the side of
mainstream IPython use.  But if you write your custom magic, you get
exactly what you want AND it's much more likely to work with future IPython
versions. :)

-andy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140710/b0baea85/attachment.html>


More information about the IPython-dev mailing list