[IPython-dev] Fwd: [Matplotlib-users] Improved dashing for black and white plots?

Walter Dörwald walter at livinglogic.de
Wed Jul 12 13:37:16 EDT 2006

Fernando Perez wrote:
> Hey guys,
> in case one of you wants to have a serious go at this idea.  I think
> it would be pretty cool, but it's not completely trivial to implement.

BTW, here is a version of history as a ipipe table:
from IPython import ipapi

from IPython.Extensions import ipipe

class ihistory(ipipe.Table):
    def __init__(self, raw=False):
        self.raw = raw

    def __iter__(self):
        api = ipapi.get()
        if self.raw:
            return iter(api.IP.input_hist_raw)
            return iter(api.IP.input_hist)

This allows stuff like

ihistory | ifilter("'import' in _")
ihistory(True) | isort

Would it make sense to put something like this into ipipe?

An while we're at it, how about an igrep:

class igrep(ipipe.Pipe):
    def __init__(self, expr):
        self.expr = re.compile(expr)

    def __xiter__(self, mode):
        for item in ipipe.xiter(self.input, mode):
            if self.expr.search(item) is not None:
                yield item

with this you can do:

ihistory | igrep("import")


More information about the IPython-dev mailing list