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

Sebastian Haase haase@msg.ucsf....
Thu Apr 10 04:31:23 CDT 2008

On Thu, Apr 10, 2008 at 11:05 AM, Matthew Brett <matthew.brett@gmail.com> wrote:
> 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
I hope I won't we excluded from further discussions if I would prefer
to stick with my "single capital" approach for my "every day modules".
I already have a default, "import numpy as N" (and some others of my
own modules) for more then 6 years. All over my code.
I've just gotten really used to it .....
At least Chris Barker seems to like the capital "N" also ;-)

Most important:
            please don't use "from numpy import *"
I like being reminded of the (495 or so) names coming from there ....

Sebastian Haase

More information about the Numpy-discussion mailing list