Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
bug-report jupiter's ipython notebook #10646
Comments
|
sp.integrate is a submodule of SciPy, so you need to import it once for it
to be available.
That's how python work so I'd be worried about changing the behavior.
The confusion is likely that many modules do implicitly import their
submodules, which makes things like `import foo; foo.bar.func()` appear to
be correct, though it is likely not. One classic example is matplotlib that
used to have a `matplotlib.finance` submodule.
It is - I agree - a behavior of python that may be confusing at first sight
but is the reasonable one.
Sorry I'm on my phone so code examples are hard to write.
…
|
ethan1987-2
commented
Jun 9, 2017
|
but then how come there's no problem doing: |
|
Well because something else does import it.
So if something else is importing it, it will be available, and as you see it's Python behavior not IPython or Jupyter. Spyder may do imports as well, maybe it import |
ethan1987-2 commentedJun 8, 2017
i was scripting with spyder 3 and using ipython and noticed that jupiter's nb can't work this:
import scipy as sp
...
sp.integrate.nquad(f,intervs)
it yields and error stating that there is no integrate function in module sp
but if you do:
import integrate from scipy
...
integrate.nquad(f,intervs)
then there is no problem at all!