[IPython-dev] IPython1 API design question

killian koepsell koepsell@gmail....
Sat Feb 9 12:51:23 CST 2008


On Feb 8, 2008 8:16 AM, Brian Granger <ellisonbg.net@gmail.com> wrote:
> Hi,
>
> I have been working on IPython1 a lot this week and have run into an
> API design dilemma.  Because the IPython1 API will be the core aPI
> that all of us develop to in the near future, I wanted to get some
> opinions about the issue.  Here we go...
>
> The IPython1 API has methods:
>
> push(self, **namespace)            # push namespace of key, values
> pairs into the users namespace
> [...]
> But, here is the problem we are running into.  In various parts of the
> API, we need to add additional arguments to these methods.  The two
> that have come up are:
>
> block -> should the call block or not?
> targets -> when you are working with multiple ipython core instances,
> which should you push/pull to.

hi brian,

what about an approach where you extract the reserved keywords manually?
something like

def push(self,**kargs):
 ns = kargs.copy()
 block = ns.pop('block', False)
 targest = ns.pop('targets', 'all')
 ...

kilian


More information about the IPython-dev mailing list