[Numpy-discussion] Style guide for numpy code?

Chris Barker - NOAA Federal chris.barker at noaa.gov
Thu May 9 11:25:30 EDT 2019


Somehow that got sent before I was done. (Like my use of the passive voice

Here is a complete message:

Do any of you know of a style guide for computational / numpy code?

I don't mean code that will go into numpy itself, but rather, users code
that uses numpy (and scipy, and...)

I know about (am a proponent of) PEP8, but it doesn’t address the unique
needs of scientific programming.

This is mostly about variable names. In scientific code, we often want:

- variable names that match the math notation- so single character names,
maybe upper or lower case to mean different things ( in ocean wave
mechanics, often “h” is the water depth, and “H” is the wave height)

-to distinguish between scalar, vector, and matrix values — often UpperCase
means an array or matrix, for instance.

But despite (or because of) these unique needs, a style guide would be
really helpful.

Anyone have one? Or even any notes on what you do yourself?



Christopher Barker, Ph.D.

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20190509/8b157cdf/attachment.html>

More information about the NumPy-Discussion mailing list