[IPython-dev] Flat is better than nested

Carlos Córdoba ccordoba12 at gmail.com
Mon May 20 13:00:04 EDT 2013


Hi,

@Aaron: A @public decorator seems really cool, it makes look code really 
neat! I'll investigate how to include it in our PR.

@Trevor: I think you are missing the point: these changes are not meant 
for regular users but for projects that are using IPython as a library. 
The idea is to put in __all__ the main pieces of qtconsole (not only 
RichIPythonWidget, but also QtKernelManager, QtKernelClient, etc) to 
tell those projects what elements they need to rely on to build a 
customized frontend.

Cheers,
Carlos

El 20/05/13 11:26, W. Trevor King escribió:
> On Fri, May 17, 2013 at 11:19:47AM -0500, Carlos Córdoba wrote:
>> For us in Spyder it would be better to be able to import things like
>> RichIPythonWidget as
>>
>> from IPython.frontend.qt import RichIPythonWidget
>>
>> instead of
>>
>> from IPython.qt.console.rich_ipython_widget import RichIPythonWidget
>>
>> because even without "frontend" there are four levels of nested modules
>> to reach one of the most essential pieces of that frontend.
>>
>> So why not add an __all__ attribute to each frontend instead?
> I've just been skimming this thread, but I'd caution against namespace
> squashing for scripting things (not very DRY).  If users are calling
> RichIPythonWidget from their IPython session, then providing a
> shortcut namespace is fine (à la Matplotlib's pylab [1]), but having
> multiple script-oriented locations is just confusing.  In this case,
> it might be best to have:
>
>    from ._rich_ipython_widget import RichIPythonWidget
>
> in IPython.qt.console (or IPython.qt?), which all consumers have to
> use instead of importing the (now private) rich_ipython_widget module
> directly.
>
> Cheers,
> Trevor
>
> [1]: http://matplotlib.org/faq/usage_faq.html#matplotlib-pylab-and-pyplot-how-are-they-related
>
>
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20130520/fabd537c/attachment.html>


More information about the IPython-dev mailing list