Skip to content

prefer kwargs to args in python and cython #49

Open
@js850

Description

@js850

On the python and cython level we should use keyword arguments rather than required arguments wherever possible. As an example look at https://github.com/pele-python/mcpele/blob/master/mcpele/monte_carlo/_action_cpp.pyx#L18

most of the arguments could have reasonable default values. Besides making things easier to call, it makes it much clearer also:

RecordEnergyHistogram(0, 10, bins=100, eqsteps=1e4)

is much clearer than

RecordEnergyHistogram(0, 10, 100, 1e4)

Where you have to look at the function definition to know what 100 and 1e4 are referring to. Also, we can change the order of the kwargs without worrying about messing anything up.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions