Simplifying code
See original GitHub issueMost, if not all, np.
, plt.
, ax.
, fig.
, and mpl.
can be safely removed if importing *
directly in the main name namespace. Currently there are so many useless repetitions, IMHO.
from matplotpib.pylab import *
would make things much cleaner and simple.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Are there any easy-to-follow/reliable methods for simplifying ...
There are indeed techniques for gradually simplifying code and improving design by doing so. The general technique is known as "refactoring" ...
Read more >Five Ways to Simplify Your Code | Dice.com Career Advice
Five Ways to Simplify Your Code · Refactoring. Understanding someone else's code can be hard. · Moving to OOP and/Or Functional Styles ·...
Read more >15 JavaScript Tips: best practices to simplify your code
15 JavaScript Tips: best practices to simplify your code · 1. Declare and initialize your variables at the top · 2. Build modular,...
Read more >(Over)simplify Your Code - Mutually Human
Pretty straightforward stuff. Having many small methods separates our code into bite-size chunks that are easier to test. Testing greatly increases the quality ......
Read more >How to Simplify Code Complexity: Avoid These ... - Turing
This post shares six tips to help developers understand code complexity and simplify their code. Let's get started.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I fully agree with @Atcold here. Usually the first thing I do after starting Python is
I appreciate that the prefixes
np.
,plt.
,ax.
,fig.
, andmpl.
have the advantage of showing specifically which module or object is being used, but in practice I find it only matters when I am writing a script to be used for all eternity. In daily life, I almost never use the prefixes, and I would find it annoying if I had to use them all the time.On a side note, I don’t think this is the responsibility of a visualization library. If designed from scatch, that would be a separate library. Even though, we don’t recommend
pylab
it will stay.The cheat sheet is targeted at all users of matplotlib. It’s also much simpler for pylab users to ignore prefixes in the cheat sheet than for others to guess them if they weren’t there.