Hacker News new | ask | show | jobs
by dheera 873 days ago

    from matplotlib import pyplot as plt
WTF? Broken from right there. What's a plt? "o" key broken? Why didn't they just call it pyplot? Why not just

    import pyplot
    pyplot.plot(lambda x: math.sin(x))
    pyplot.plot(x=[0,1,2],y=[0,2,4])
3 comments

People who are making plots in the terminal don't want to type out the fully qualified library name. Majority of plots are written and read only once during data exploration and analysis time.
The library is not forcing you to use plt as a shorthand. Nothing is stopping you from calling

from matplotlib import pyplot

pyplot.plot([0,1,2], [0,2,4])

Yeah I know. It's just that they've created an ecosystem of "plt" and that makes me want to use the entire library less.
It's a convention of the math-heavy python libraries, numpy and pandas also often get imported as np and pd.