question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Most, 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:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
mdehooncommented, Jul 10, 2020

I fully agree with @Atcold here. Usually the first thing I do after starting Python is

>>> from pylab import *

I appreciate that the prefixes np., plt., ax., fig., and mpl. 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.

0reactions
timhoffmcommented, Jul 10, 2020

In summary, matplotlib’s pylab gives you an interactive calculator.

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.

Then, sure, it can also be used for scripting. But I don’t think it’s its primary usage. And the cheat sheet is targeted for the first group of users, IMHO. Programmers check the API or StackOverflow.

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found