Skip to content

Updated argument to mpl.ticker.LogFormatter.label_minor #6264

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

Closed
wants to merge 1 commit into from

Conversation

madphysicist
Copy link
Contributor

@madphysicist madphysicist commented Apr 3, 2016

This is PR is opened in response to #6253 (comment). It reverses the implied meaning of the input parameter.

@madphysicist
Copy link
Contributor Author

Just closed and reopened to restart Appveyor. There were no actual build errors.

@madphysicist
Copy link
Contributor Author

Squawk

@madphysicist
Copy link
Contributor Author

Bump.

@NelleV
Copy link
Member

NelleV commented Nov 29, 2016

I don't see the point in changing this, but if you are going to do this, can you replace the camel case with something more pythonic? (to for example label_minor, which btw is very confusing as this does not turn on the minor labeling but the labeling on none decade elements.)

@madphysicist
Copy link
Contributor Author

You are absolutely right. I made both the camel->_ change and updated the docs slightly. Thanks for the explanation. Hopefully this change is no longer a controversial one.

I just remembered that the whole point of the change was that the sense of the argument is opposite to the sense of the method name, but at this point I don't care much any more as long as the docs are clear enough.

Minor clarification to docs as well.
@NelleV
Copy link
Member

NelleV commented Dec 19, 2016

I am overall in favor of that change, but we will need to maintain backward compatibility for at least two version. That means adding back the previous argument name, and checking whether the user sets it manually or not, and raising a deprecation message if the user does.
I am terribly sorry not to have pointed this out earlier and not to have been more active on this. This PR completely slipped out of my mind.

@NelleV NelleV self-requested a review December 19, 2016 09:31
@NelleV NelleV self-assigned this Dec 19, 2016
@NelleV
Copy link
Member

NelleV commented Dec 19, 2016

@efiring and @tacaswell - can you comment and approve or decline this API change?

@@ -829,13 +829,13 @@ class LogFormatter(Formatter):
"""
Format values for log axis.
"""
def __init__(self, base=10.0, labelOnlyBase=True):
def __init__(self, base=10.0, label_only_base=True):
Copy link
Member

Choose a reason for hiding this comment

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

I think this fix has to hold off until we have python3 only and can do

def __init__(self, base, label_only_base, * labelOnlyBase=none)

and then deprecate it

Copy link
Member

Choose a reason for hiding this comment

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

I guess we can do this for both with

def __init__(self, base, label_only_base=True,  **kwargs)

Copy link
Member

Choose a reason for hiding this comment

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

The easiest way to do this is …, label_only_base=True, labelOnlyBase=None and check whether labelOnlyBase was provided to deprecate it.

"""
self._base = base + 0.0
self.labelOnlyBase = labelOnlyBase
self.label_only_base = label_only_base
Copy link
Member

Choose a reason for hiding this comment

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

This is also a public API break which should be patched over with a property, but should also wait for changing the parameter name in the __init__

@tacaswell
Copy link
Member

I am not convinced that the work to maintain back compatibility and then the deprecation cycle is worth changing the name.

weak 👎 .

@madphysicist
Copy link
Contributor Author

@NelleV. There has been a lot going on, so I did not expect much attention to this PR.

I am getting the sense that this may be too much work for a really trivial change that could probably be solved by documentation. Just for the fun of it, I will add the deprecation in to see if you like it.

@efiring
Copy link
Member

efiring commented Dec 19, 2016

I am not in favor of this. If we are going to have a CamelCase cleanup in ticker, it should be done all at once rather than piecemeal. (Whether it will ever be worth doing is debatable.)
The real problem, correctly noted by @madphysicist, is that label_minor() is nonsensical. The solution is to deprecate and remove it. (I doubt it is every used in practice, so I don't think this is a big change.) It's replacement is the labelOnlyBase attribute, which I imagine will end up as a Trait if the Traitlets work goes to completion. It could be a property in the interim, but leaving it as a plain attribute is perfectly adequate and Pythonic.

@NelleV
Copy link
Member

NelleV commented Dec 21, 2016

There seems to be a consensus that this patch is not worth the trouble. I am closing the PR.
@madphysicist sorry about the time it took.

@QuLogic QuLogic modified the milestones: unassigned, 2.1 (next point release) Dec 22, 2016
@madphysicist
Copy link
Contributor Author

I think under the circumstances that is the only thing to do. Thanks for taking care of it for me.

@madphysicist madphysicist deleted the log-label-minor branch December 22, 2016 05:59
@tacaswell
Copy link
Member

@madphysicist Just to re-iterate @NelleV , thank you for working on this. Saying no is one of the hard things about maintaining mpl 😞 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants