Skip to content

Conversation

@noamcohen97
Copy link
Contributor

@noamcohen97 noamcohen97 commented Apr 19, 2025

setattr(namespace, action.dest,
self._get_value(action, action.default))
elif (action.nargs not in (OPTIONAL, None) and
isinstance(action.default, (list, tuple)) and
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like it's going to create issues. What is so special about list and tuple? What about set, deque, etc..?

The design of argparse is very loose. I suspect "fixing" this without breaking backwards compatibility might be challenging.

@savannahostrowski
Copy link
Member

Hey — thanks for the PR! Unfortunately, changing this behavior is likely to break existing user code. Much of argparse’s design, quirks included, has been stable for a long time, so even seemingly simple changes can have pretty widespread impact. I think we'd be better off clarifying this behaviour in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants