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

Alan Gauld alan.gauld at btinternet.com
Fri Aug 8 23:59:51 CEST 2008


"S Python" <spython01 at gmail.com> wrote
> Thanks for the clarification.  I had always wondered what the 
> difference was.

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.

HTH,


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 




More information about the Tutor mailing list