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

parse_args should return dict #53

Open
granders opened this issue Jun 1, 2015 · 1 comment
Open

parse_args should return dict #53

granders opened this issue Jun 1, 2015 · 1 comment

Comments

@granders
Copy link
Contributor

granders commented Jun 1, 2015

parse_args function in main.py returns a Namespace object.

Returning a dict/kwargs style object would make using parsed command-line arguments slightly simpler (and in MockArgs for unit tests for example).

@ewencp
Copy link
Contributor

ewencp commented Jun 1, 2015

More specifically, the issue isn't really with anything in main -- those method can do whatever makes the code there clear and simple since that code is completely isolated to that file.

The main complaint was that the Namespace object was then passed to the SessionContext constructor. This is not an idiomatic way of passing options and ties that API to an options object that has attributes for each option. A more idiomatic API would just use keyword arguments, and main could just pass in the arguments like this:

session_context = SessionContext(session_id, results_dir, cluster=None, **vars(args))

That would requires SessionContext to take **kwargs to handle any non-SessionContext related arguments; alternatively, we could filter down to the exact set we expect to be passed to SessionContext.

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

2 participants