Skip to content

Commit 38f17dd

Browse files
Copilotmmcky
andcommitted
Update SciPy lecture: Fix outdated import statement for SciPy 1.15+ compatibility
Co-authored-by: mmcky <8263752+mmcky@users.noreply.github.com>
1 parent 70120bc commit 38f17dd

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

lectures/scipy.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,11 @@ In this lecture, we aim only to highlight some useful parts of the package.
4949

5050
SciPy is a package that contains various tools that are built on top of NumPy, using its array data type and related functionality.
5151

52-
In fact, when we import SciPy we also get NumPy, as can be seen from this excerpt the SciPy initialization file:
52+
In older versions of SciPy, importing SciPy would also import NumPy symbols into the global namespace.
5353

54-
```{code-cell} python3
55-
# Import numpy symbols to scipy namespace
56-
from numpy import *
57-
from numpy.random import rand, randn
58-
from numpy.fft import fft, ifft
59-
from numpy.lib.scimath import *
60-
```
54+
However, modern versions of SciPy (1.15+) have a cleaner approach and no longer automatically import NumPy symbols. This is better practice as it avoids namespace pollution.
6155

62-
However, it's more common and better practice to use NumPy functionality explicitly.
56+
Instead, you should import NumPy explicitly:
6357

6458

6559
```{code-cell} python3

0 commit comments

Comments
 (0)