Issue
from matplotlib import pyplot as plt
import matplotlib.pyplot as plt
Are the above statements equivalent? Which is more readable/better form?
Solution
Even though they are equivalent, I think there is a pretty good argument that the second form import matplotlib.pyplot as plt
is objectively more readable:
It is generally customary to use
import matplotlib.pyplot as plt
and suggested in the matplotlib documentation (see http://matplotlib.org/users/pyplot_tutorial.html etc...) so this will be more familiar to most readers.import matplotlib.pyplot as plt
is shorter but no less clear.import matplotlib.pyplot as plt
gives an unfamiliar reader a hint that pyplot is a module, rather than a function which could be incorrectly assumed from the first form.
Answered By - Eric Appelt
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.