[Numpy-discussion] Numpy-discussion Digest, Vol 19, Issue 44

Matthew Brett matthew.brett@gmail....
Thu Apr 10 04:05:35 CDT 2008


Hi Joe,

I do see your point - and agree that typing and cruft make code harder
to write and read, to some extent.  But I think the point is - and I'm
increasingly finding this - that a judicious use of namespaces and
'from' statements makes the code much easier to read, as in

import numpy as np
from numpy import dot, any, arange, reshape

and so on.  And, personally, I tend to prefer to use lower case for
modules, and the occasional upper case for loop variables and the
like:

for L in lines:
    print L

type thing.  Upper case also draws the eye to the capital letter, so

print N.sin(a)

pulls the eye to the N, so you have to disengage and remind yourself
that it's the sin(a) that is important, whereas:

print np.sin(a)

less so - in my view.  So, as a previous user of 'import numpy as N',
I prefer 'import numpy as np'

Best,

Matthew


More information about the Numpy-discussion mailing list