[IPython-dev] IPython1 API design question
Stefan van der Walt
stefan at sun.ac.za
Fri Feb 8 17:12:59 EST 2008
On Fri, Feb 08, 2008 at 09:16:25AM -0700, Brian Granger wrote:
> The alternate API would look some thing like this:
>
> push(self, ns, block=True, targets='all')
> pull(self, keys, block=True, targets='all')
>
> And be used:
>
> push(dict(a=10,b=30), block=False) # targets = 'all'
> pull(('a','b')) # block=True, tagets='all'
>
> the main disadvantage is that a user has to manually build the dict
> and tuple. For pull, we could do a test to see if keys is a string
> and build the tuple for then, but for the dict, they really have to
> build it using dict or {}
>
> So, which of these approaches seems better, both from the development
> and user's perspective? Thoughts?
For what it's worth, I like the idea of pushing namespaces. With the
current system, you can do (as a random example)
push(*_ip.user_ns)
but then you have to make sure that the dict doesn't contain some
special keywords. I imagine it would be better to shield the user
from such unexpected side-effects.
Regards
Stéfan
More information about the IPython-dev
mailing list