[Numpy-discussion] Import NumPy in Self-defined function script
Sun Feb 22 17:47:41 CST 2009
Am 23.02.2009 um 00:19 schrieb Tim:
> I am defining a function in file "trainer.py". It requires a module
> called numpy as following:
> Another script "controller.py" calls this function as:
> [code]#! /usr/bin/env python
> # from numpy import *
^ This is a comment, you are not importing numpy!
I think it is generally better to not do
from ... import *
because it messes up the namespace; it can happen that a second module
overwrites a function from the first module.
This happens for example with:
from numpy import *
from pylab import *
pylab has a "load" function which is not the same as the numpy "load"
I always use
import numpy as N
More information about the Numpy-discussion