Menu

#1 import numpy as np

open
nobody
None
5
2009-02-24
2009-02-24
Eric Schug
No

Importing everything is a source of possible errors (e.g. pylab
overwrites numpy names)

from numpy import *
import scipy
# if available import pylab (from matlibplot)
try:
from pylab import *
except ImportError:
pass

I would prefer the current standard
import numpy as np
import matplotlib.pylab as plt

and keep the name space as part of the name, e.g. np.dot, np.exp, ...

Discussion


Log in to post a comment.