[Tutor] Confused about "import Numeric" vs "import numpy" forArrays

S Python spython01 at gmail.com
Sat Aug 9 00:54:51 CEST 2008


> A useful tip is that if you have a long module name you can also use
>
> import module as shortname
>
> eg
>
> import numpy as n
>
> and then access numpy.foo() as
>
> n.foo()
>
> Sacves a lot of typing for a slight loss of clarity in
> maintenance - you have to remember which module the
> short names refer to! I tend to use full names in real code
> and use the abbreviated form when using the >>> prompt.
>

Alan - Great suggestion!  As I'm reading through the numpy
documentation, there are a lot of great functions that I'd like to
learn to use so your advice definitely helps.  I was getting tired of
constantly having to type "numpy.array" or "numpy.ones" all the time.
Thanks again.

Samir


More information about the Tutor mailing list