[SciPy-User] (pas de sujet)

Chris Weisiger cweisiger at msg.ucsf.edu
Mon Apr 4 14:53:08 EDT 2011


On Mon, Apr 4, 2011 at 11:45 AM, Christopher Barker
<Chris.Barker at noaa.gov>wrote:

> On 4/1/11 3:49 PM, Robert Kern wrote:
> > On Fri, Apr 1, 2011 at 16:33, Ralf Gommers<ralf.gommers at googlemail.com>
>  wrote:
> >> Do you feel like writing a patch for the
> >> howto_document file?
> >
> > https://github.com/numpy/numpy/pull/67
>
> OK -- but I'm a bit confused as to what we do recommend as an import
> style. I know I feel strongly that:
>
> 1) "import *" is a Bad Idea
>
> It's a Good Idea to have a community standard. I think the community as
> more or less settled on:
>
> import numpy as np
>
> but I have no idea for scipy.
>
> Personally I generally find a use only a few specific things form scipy
> in an given script, so:
>
> from scipy.some_module import some_class
>
> works great for me, but I don't know if others have broad enough use of
> lots of scipy modules in a single script such that that would be onerous.
>
> So: what do folks use/recommend?
>
>
I think by now my personal stance is pretty clear. :) I accept most people
aren't willing to have as long of invocations as I am. However, I do still
strongly feel that the only time it's reasonable to have a bare
(namespace-free) name in a piece of code is if the name is defined in that
module. In other words, names without attached namespaces are implicitly
locally-defined. Thus I don't like "from module.submodule import function"
because when you use function later on, it's not clear that it came from
outside. "from module import submodule" is fine though: when you see
"submodule.function" you know where to start looking for information on the
function.

-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20110404/057b592f/attachment.html>


More information about the SciPy-User mailing list