Skip to content

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

@liamtoney

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions