[IPython-dev] RFC: IPython.ipapi for "public" ipython API.
vivainio at gmail.com
Wed Jan 18 02:37:58 CST 2006
On 1/18/06, Fernando Perez <Fernando.Perez at colorado.edu> wrote:
> Good enough for now: I see you're hacking into the __IP global, which is fine
> for the stable branch. That's something that WILL change, and the module
Actually, I'm not - the __IP is set in _init_with_shell() with which
the interpreter object "introduces" itself to the module. It just
happens to be called __IP, I can rename it if it's confusing.
> approach may need to go, but we'll cross that bridge when we get to it. For
I admit that the current module approach breaks if multiple ipython
shells exist in the same process and introduce themselves to the IP
api (how common is that anyway?). I think I'll add a factory function
"get_api()" that returns what is now used as "ip" in the examples.
So instead of
import IPython.ipapi as ip
ip = IPython.ipapi.get_api()
Which for now returns the module itself, but in the future will be
guaranteed (at least pre-1.0) to point at the same shell instance even
when multiple shells are instantiated.
Incidentally, anyone have a good idea how to return the current module?
Ville Vainio - http://tinyurl.com/2prnb
More information about the IPython-dev