Skip to content

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

Closed

Description

@liamtoney

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.)

Activity

  1. weiji14 commented on Nov 9, 2019

    @weiji14
    Member

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

  2. added
    bug
    on Nov 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions