[SciPy-User] (pas de sujet)
Christopher Barker
Chris.Barker at noaa.gov
Mon Apr 4 14:45:05 EDT 2011
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?
On 4/1/11 1:44 PM, eat wrote:
> I just like to ask yours and others matured ones opinion about
> systematically using import pattern like:
> from numpy import x, y, z, longname as ln
> from scipy import u, v, x as sx
> from scipy.abc import e, f, g
I think that gets almost as bad as "import *", once you use a lot -- not
as bad, but still not good.
While I don't want "import *", but I also don't want really long method
names like:
"scipy.special.erf(...)"
So I think there is a bit of discretion in every choice -- If I'm using
only one or two functions, I'll do:
from scipy.special import erf
But If I'm using a lot from a given module, I tend to strip off all but
the last module name:
from scipy import special
and maybe even give it a shorter name:
from scipy import special as spc
But this still keeps a qualification in place in the code.
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
More information about the SciPy-User
mailing list