by amelius · 5y ago · 0 comments
For example, this is mymod.py:
import numpy as np
def f(x): return 2*x
And here it is imported: from mymod import *
f(10) # Works as expected.
np.sum([10, 20]) # Works, but shouldn't work.Docs: https://docs.python.org/3/tutorial/modules.html#importing-fr...
import numpy as _np # numpy will be hidden
def f(x): return x * 2
def _g(x): return _np.array([x, x]) # _g is a non-public functionThe `from x import y` syntax is unaffected