windrose
windrose copied to clipboard
fix some of my messy previous change that broke theta_labels...
When fiwing a previous bug, I added a new one... Theta labels were not correctly displayed anymore.
Here is a fix + add some test.
HéHé.
This code fails for python 2. Do we care about supporting it?
Why not changing
def __init__(self, *args, theta_labels=DEFAULT_THETA_LABELS, **kwargs)
to
def __init__(self, *args, **kwargs)
and get theta_labels from kwargs if it exists or default it to DEFAULT_THETA_LABELS
so it will works both with Python 2.7 and 3.x
But the question on dropping Python 2.7 should be considered
You should also avoid passing list as a default parameter according https://florimond.dev/blog/articles/2018/08/python-mutable-defaults-are-the-source-of-all-evil/
(use None instead)
Indeed. It's just that I am not a fan of "kwar.poping" things, because it hide the potential argument of the function.
For the mutable argument, I agree. Normally it is never modified so I did it, but sure it may cause bug later on.
@scls19fr I know you already approved this one but do you mind taking a second look? I rebased and fixed the tests, it should be good to go.
PS: in a way this implements https://github.com/python-windrose/windrose/pull/120