Conversation
25e008a to
ec9cc33
Compare
|
Are there any benefits to this other than a bit of organization? |
|
Cutting down on pyflakes output... |
|
Removing unused imports could improve matplotlib's import time and memory usage. I'm not saying necessarily significantly, but I'll take what I can get for free. 😁 |
|
PEP 8 doesn't like |
|
It only helps if they are thing that would not be imported other wise. If things are already in sys.modules the import is basically free. |
ec9cc33 to
bf3416c
Compare
|
Note that I never claimed this was for performance :p |
|
I think we explicitly do not check this bit of pep8, if we are going to do this travis should enforce it. The dark side of 'discover-the-api-via-tab-complete' is that users will have found and used some of those un-used imports so I expect this to break some user code. It should get some level of mention in the API changes docs. |
|
Not saying that this PR fixes pep8; rather, pep8 was unhappy because it wanted conditional imports (vs Python version) to be at the bottom of the import list. |
bf3416c to
b2dae53
Compare
|
@tacaswell I agree...that's why I said "could". 😁 Also, the unused import adds to the module's globals dict (not to mention takes a few instructions to execute), so that's technically more memory usage (and CPU). I'm not saying it's significant, but it's a "free" fix to not ask for things you don't use. |
b2dae53 to
bf67b92
Compare
|
grouped some more imports (in a separate commit) |
85b35f6 to
23bd9df
Compare
PR Summary
Same as #9929, but for the lib itself: remove unused imports and sort/group some remaining imports.
PR Checklist