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

Short- and long-form kwargs can coexist silently #377

Closed
liamtoney opened this issue Nov 9, 2019 · 1 comment · Fixed by #537
Closed

Short- and long-form kwargs can coexist silently #377

liamtoney opened this issue Nov 9, 2019 · 1 comment · Fixed by #537
Labels
bug Something isn't working

Comments

@liamtoney
Copy link
Member

Description of the problem

Python doesn't allow keyword arguments to be repeated. Our current setup does allow for e.g. the following, however:

import pygmt
fig = pygmt.Figure()
fig.basemap(region=[0, 1, 0, 1], B='+tbar', frame='+tfoo')
fig.show(method='external')

This example produces

ex

silently overriding the B='+tbar' "repeated" argument. I feel like we should raise a SyntaxError in this case, like what Python does for repeated kwargs. I think this would involve modifying the use_alias() decorator, but I'm not totally sure. This addresses the discussion in #359 (comment). If #262 were implemented, this could be a non-issue.

(I'm not sure if this is a bug or a feature request; I chose bug.)

@weiji14
Copy link
Member

weiji14 commented Nov 9, 2019

Let's mark it down as a bug 😆 Hopefully our users spot this.

@weiji14 weiji14 added the bug Something isn't working label Nov 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants