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

Behavior of "allow_missing=True" with "multiple=True" #7

Closed
dgilland opened this issue Aug 30, 2014 · 2 comments
Closed

Behavior of "allow_missing=True" with "multiple=True" #7

dgilland opened this issue Aug 30, 2014 · 2 comments

Comments

@dgilland
Copy link

Currently, when you define an Arg such as:

myargs = {'somearg': Arg(allow_missing=True, multiple=True)}

When somearg is not supplied, the parsed myargs is {'somearg': []}.

However, when you define an Arg with multiple=False:

myargs = {'somearg': Arg(allow_missing=True)}

When somearg is not supplied, the parsed myargs is {}.

I was surprised by this behavior as I assumed that when allow_missing=True and the argument is not supplied, that no parsed value would be returned for both the multiple=False and multiple=True cases.

Is this intentional? Or should no parsed value be returned in the case of Arg(allow_missing=True, multiple=True) instead of []?

@sloria
Copy link
Member

sloria commented Aug 30, 2014

@dgilland You are correct; the current behavior is incorrect. In your example, 'somearg' should not be in the parsed arguments if it is not passed.

I will issue a fix soon. Thanks for reporting!

@sloria sloria closed this as completed in bc5c5c3 Aug 30, 2014
@dgilland
Copy link
Author

Awesome! Thanks for fixing the issue so quickly! 👍

Kudos on the library as well! Very helpful/useful.

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