r/Python • • Jun 09 '16

Scientific Python Cheat Sheet

https://ipgp.github.io/scientific_python_cheat_sheet/
476 Upvotes

62 comments sorted by

View all comments

6

u/hharison Jun 10 '16

This is kind of silly, and there's no reason to prefer one way or the other, but does anyone else do from matplotlib import pyplot as plt rather than import matplotlib.pyplot as plt?

2

u/deaddodo Jun 10 '16

The more "pythonic" way of handling imports is argued to be:

import blah[.blahbity] [as blah2]

but both are perfectly acceptable.

I generally avoid "from...." since it makes the import lines look cluttered (IMO).

1

u/hharison Jun 11 '16

Just curious if you weren't using an alias but wanted to do a nested import without the parent namespace would you do import scipy.stats as stats or from scipy import stats? Just thinking out loud here...