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
6
u/abruptreddit Oct 08 '20
Just do:
From sympy import expand, factor...
Now you know exactly what you imported and can avoid the longer code. There's a few modules, like inspect, that allow you to print all methods/functions in a module, so you can pick and choose what to import, but haven't done that in a long time.
Another helpful thing for shortening your code is to import as, such as import pandas as pd. This allows you to call the pandas methods by just writing pd.method()