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

Ability to change the keys? #11

Closed
WeatherGod opened this issue Aug 20, 2015 · 4 comments · Fixed by #13
Closed

Ability to change the keys? #11

WeatherGod opened this issue Aug 20, 2015 · 4 comments · Fixed by #13

Comments

@WeatherGod
Copy link
Member

While I totally agree that we should not be able to change the values associated with each key, what about being able to change out the key names? A use case would be for normalizing property names:

>>> c = cycler('color', 'rgb') + cycler('lw', [1, 2, 3])
>>> c.key_change('lw', 'linewidth')
cycler('color', ['r', 'g', 'b']) + cycler('linewidth', [1, 2, 3])
@tacaswell
Copy link
Member

You can do

c2 = cycler('new_name', c1)

which accomplishes the same thing for a single cycler.

I am hesitant, but see the use case for normalization which makes me 75/25 in favor.

@WeatherGod
Copy link
Member Author

The problem with that approach is that it only works for a single-property cycler. If the cycler is a multi-property one...

>>> from cycler import cycler
>>> c = cycler('color', 'rgb') + cycler('lw', [1, 2, 3])
>>> c2 = cycler('linewidth', c)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build/bdist.linux-x86_64/egg/cycler.py", line 301, in cycler
ValueError: Can not create Cycler from a multi-property Cycler

@WeatherGod
Copy link
Member Author

Would it help if I implement it for you? (it is a slow day today in the office)

@tacaswell
Copy link
Member

Yes

On Thu, Aug 20, 2015, 4:06 PM Benjamin Root notifications@github.com
wrote:

Would it help if I implement it for you? (it is a slow day today in the
office)


Reply to this email directly or view it on GitHub
#11 (comment).

This issue was closed.
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 a pull request may close this issue.

2 participants