Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JRE - Modified 'use' so that it will only warn if the requested backend ... #1445

Merged
merged 1 commit into from Nov 5, 2012
Merged

Conversation

jrevans
Copy link

@jrevans jrevans commented Nov 1, 2012

Modified the 'use' function so that if it is repeatedly called, it will only give a warning if the requested backend is different from the current one.

…nd is different that what is currently set.
@mdboom
Copy link
Member

mdboom commented Nov 1, 2012

+1. Seems like a reasonable thing to do.

# Check if we've already set up a backend
if 'matplotlib.backends' in sys.modules:
if warn:
# Warn only if called with a different name
if (rcParams['backend'] != name) and warn:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Complete nit-pick: I would typically put the warn first - because it is as far simpler evaluation (is a boolean True or False vs get the value from the dictionary and compare the strings).

I do not expect you to make this change (it is so trivial and adds nothing to the PR), I just wanted to mention it for future consideration.

Thanks,

@pelson
Copy link
Member

pelson commented Nov 2, 2012

Nice fix to the problem. Thanks @jrevans 👍 .

@dmcdougall
Copy link
Member

+1 good to go in my opinion. Can anyone think of anything else that needs to be added to this? If not, I think it's safe to push The Button.

pelson added a commit that referenced this pull request Nov 5, 2012
JRE - Modified 'use' so that it will only warn if the requested backend is different that what is currently set.
@pelson pelson merged commit 6fa35aa into matplotlib:master Nov 5, 2012
@jrevans jrevans deleted the working branch May 19, 2014 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants