If one has run
from numpy import *
then the built-in all
, and several other functions, are shadowed by numpy
functions with the same names.
The most common case where this happens (without people fully realizing it) is when starting ipython
with ipython --pylab
(but you shouldn't be doing this, use --matplotlib
, which doesn't import anything into your name space, but sets up the gui-related magic, instead).
Once this has been done, is there anyway to call the built-in functions?
This is worth doing because the built-in all
can deal with generators, where as the numpy
version can not.
you can just do
all = __builtins__.all
The statement from numpy import *
basically do two separate things
numpy
by re-assigning the original value from __builtins__
you can restore the situation for the functions you need.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With