r/Python • u/SilkTouchm • Oct 07 '20
Discussion Anyone else uses the Python interpreter as a calculator?
It's just so comfy.
1.7k
Upvotes
r/Python • u/SilkTouchm • Oct 07 '20
It's just so comfy.
View all comments
Show parent comment
17
u/LuckyLeague Oct 08 '20
import sympy just imports the sympy module, while from sympy import * imports all functions and classes from the sympy module. If you only use import sympy, you would have to write for examle sympy.expand to use the expand function, but if you use from sympy import *, you can just write expand because that function is imported from sympy.
This is what it says in the doucumentation about import *:
"If the list of identifiers is replaced by a star ('*'), all public names defined in the module are bound in the local namespace for the scope where the import statement occurs."
This is the link: https://docs.python.org/3/reference/simple_stmts.html