Eric Firing <[EMAIL PROTECTED]> writes:

> 1) Present: always be explicit: npy.sin or ma.sin or math.sin or 
> cmath.sin. [...]
>
> 2) Pick a set of math symbols that may be imported directly from numpy 
> at the top, and either import all routinely, or import as needed.  

There's also an option that might be labeled 1a: import the necessary
symbols in the function where they are used:

def foobar():
    from math import pi, sin, cos
    from numpy import arange, ones, zeros
    # ...

This has the advantage that the documentation on what every symbol means
is close to the code that uses the symbols, and the disadvantage of
being slower because every call of the function causes a new import.
This may or may not matter, depending on how often the function is
called.

-- 
Jouni K. Seppänen
http://www.iki.fi/jks


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to