The print line is simply a way to "use" scipy.optimize. A "real" usage (MWE) would be
```
import scipy.optimize
import scipy as sp
res = sp.optimize.root(lambda x: x, 1)
```
This has the same problem. Your example with del _ is a indeed a workaround (though it is pretty ugly!)
It is extremely common to use scipy, numpy, and matplotlib via:
import numpy as np
import scipy as sp
from matplotlib import pyplot as plt
then to use np. sp. or plt. in ones code. However, especially with scipy, the top level import does not bring in the whole library, hence the need for
import scipy.optimize
Although this might be difficult to detect, I believe it is a real bug since scipy.optimize is indeed used (just through the standard alias sp.optimize)
The print line is simply a way to "use" scipy.optimize. A "real" usage (MWE) would be
```
import scipy.optimize
import scipy as sp
res = sp.optimize. root(lambda x: x, 1)
```
This has the same problem. Your example with del _ is a indeed a workaround (though it is pretty ugly!)
It is extremely common to use scipy, numpy, and matplotlib via:
import numpy as np
import scipy as sp
from matplotlib import pyplot as plt
then to use np. sp. or plt. in ones code. However, especially with scipy, the top level import does not bring in the whole library, hence the need for
import scipy.optimize
Although this might be difficult to detect, I believe it is a real bug since scipy.optimize is indeed used (just through the standard alias sp.optimize)