[SciPy-User] (pas de sujet)

Robert Kern robert.kern at gmail.com
Fri Apr 1 16:56:08 EDT 2011


On Fri, Apr 1, 2011 at 15:02, Ralf Gommers <ralf.gommers at googlemail.com> wrote:
> On Fri, Apr 1, 2011 at 9:59 PM, Robert Kern <robert.kern at gmail.com> wrote:
>> On Fri, Apr 1, 2011 at 14:33, Christopher Barker <Chris.Barker at noaa.gov> wrote:
>>
>>> I'm not sure if:
>>>
>>> import scipy as sp
>>>
>>> is as common, but it seems reasonable to me.
>>
>> It's utterly useless since the scipy subpackages aren't imported along
>> with it. Don't do it.
>
> Our docs disagree:
> https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt

That part was written by someone plagued by hobgoblins and who didn't
think it through.

> It still saves a few characters writing "sp.linalg.xxx" instead of
> "scipy.linalg.xxx".

False comparison. "scipy.linalg.xxx" is not thing to compare to.

  # Right way.
  from scipy import linalg
  linalg.xxx

vs.

  # Silly, unnecessarily complicated way.
  import scipy as sp
  import scipy.linalg
  sp.linalg.xxx

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco



More information about the SciPy-User mailing list