[IPython-dev] get_ipython() versus _ip

Thomas Kluyver takowl at gmail.com
Tue Jun 28 20:15:09 EDT 2011


On 29 June 2011 00:55, Brian Granger <ellisonbg at gmail.com> wrote:

> The name get_ipython is 1) less likely to run into collisions than
> generic things like _ip and 2)
> get_ipython suggest that it is a public API, whereas all of the _ and
> __ names suggest that
> it is a private API.
>

That makes sense. I'd prefer to have a reference rather than a callable,
though.

Would it make sense to have a public reference called something like ipy,
and a backup copy called something like __ipy? The public name would act
like the built in variables - you can replace it if you want, but it's not
advised. Our own code would use the 'hidden' name, so magic functions etc.
would carry on working even if you did ipy = 2.

Then again, I'm comfortable with the idea of using 'hidden' name like _ip as
the only available name: it's a bit special, because it reaches outside of
the environment you're working in, so it makes sense to mark it as
different. It's also not something I'd expect most end users to be using
regularly.

Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20110629/5562e04a/attachment.html>


More information about the IPython-dev mailing list