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

prefer kwargs to args in python and cython #49

Open
js850 opened this issue Oct 8, 2014 · 0 comments
Open

prefer kwargs to args in python and cython #49

js850 opened this issue Oct 8, 2014 · 0 comments

Comments

@js850
Copy link
Member

js850 commented Oct 8, 2014

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.

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

No branches or pull requests

1 participant