Re: Mystery of module bindings!

2013-04-29 Thread Ethan Furman
On 04/29/2013 12:30 PM, Peter Rowat wrote: This must be a trivial question: I have "import numpy as np" in the python startup file. A file called mod1.py contains "def myfn..." and inside myfn there is a call to, say, "np.convolve". Interactively: python (numpy imported as np) impor

Re: Mystery of module bindings!

2013-04-29 Thread Dave Angel
On 04/29/2013 04:03 PM, Dave Angel wrote: Please ignore my previous response, obviously I misread your question entirely. I've never used a startup file, so I misread it as "script file". Yes, you need a separate import from any module that references numpy. Don't worry about performance, s

Re: Mystery of module bindings!

2013-04-29 Thread Dave Angel
On 04/29/2013 03:30 PM, Peter Rowat wrote: This must be a trivial question: I have "import numpy as np" in the python startup file. A file called mod1.py contains "def myfn..." and inside myfn there is a call to, say, "np.convolve". Interactively: python (numpy imported as np) impor

Re: Mystery of module bindings!

2013-04-29 Thread Ned Batchelder
On 4/29/2013 3:30 PM, Peter Rowat wrote: This must be a trivial question: I have "import numpy as np" in the python startup file. A file called mod1.py contains "def myfn..." and inside myfn there is a call to, say, "np.convolve". Interactively: python (numpy imported as np) import

Re: Mystery of module bindings!

2013-04-29 Thread Steven D'Aprano
On Mon, 29 Apr 2013 12:30:29 -0700, Peter Rowat wrote: > This must be a trivial question: > > I have "import numpy as np" in the python startup file. That only runs interactively. It does not run when you execute a script. > A file called mod1.py contains "def myfn..." > and inside myfn there

Mystery of module bindings!

2013-04-29 Thread Peter Rowat
This must be a trivial question: I have "import numpy as np" in the python startup file. A file called mod1.py contains "def myfn..." and inside myfn there is a call to, say, "np.convolve". Interactively: >python (numpy imported as np) >import mod1 > >mod1.myfn(...) Error: global name "n