Skip to content

Conversation

@serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Sep 9, 2025

If a short option and a single-dash long option are passed to add_argument(), dest is now inferred from the single-dash long option.


📚 Documentation preview 📚: https://cpython-previews--138699.org.readthedocs.build/

… argparse

If a short option and a single-dash long option are passed to add_argument(),
dest is now inferred from the single-dash long option.
@serhiy-storchaka serhiy-storchaka force-pushed the argparse-single-dash-long-option-dest branch from 9987fa1 to 426169f Compare September 9, 2025 10:14
@serhiy-storchaka serhiy-storchaka linked an issue Sep 19, 2025 that may be closed by this pull request
Copy link
Member

@savannahostrowski savannahostrowski left a comment

Choose a reason for hiding this comment

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

Overall, I am supportive of making dest more consistent so thanks for opening this issue and PR. However, there is one edge case that still needs to be addressed.

@bedevere-app
Copy link

bedevere-app bot commented Nov 20, 2025

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

@serhiy-storchaka
Copy link
Member Author

I have made the requested changes; please review again.

@bedevere-app
Copy link

bedevere-app bot commented Nov 20, 2025

Thanks for making the requested changes!

@savannahostrowski: please review the changes made to this pull request.

Copy link
Member

@savannahostrowski savannahostrowski left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for this!

@savannahostrowski savannahostrowski enabled auto-merge (squash) November 20, 2025 18:11
@savannahostrowski savannahostrowski merged commit 77cb39e into python:main Nov 20, 2025
46 checks passed
@serhiy-storchaka serhiy-storchaka deleted the argparse-single-dash-long-option-dest branch November 20, 2025 19:26
StanFromIreland pushed a commit to StanFromIreland/cpython that referenced this pull request Dec 6, 2025
… argparse (python#138699)

* pythongh-138697: Fix inferring dest from a single-dash long option in argparse

If a short option and a single-dash long option are passed to add_argument(),
dest is now inferred from the single-dash long option.

* Make double-dash options taking priority over single-dash long options.

---------

Co-authored-by: Savannah Ostrowski <[email protected]>
ashm-dev pushed a commit to ashm-dev/cpython that referenced this pull request Dec 8, 2025
… argparse (python#138699)

* pythongh-138697: Fix inferring dest from a single-dash long option in argparse

If a short option and a single-dash long option are passed to add_argument(),
dest is now inferred from the single-dash long option.

* Make double-dash options taking priority over single-dash long options.

---------

Co-authored-by: Savannah Ostrowski <[email protected]>
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

Successfully merging this pull request may close these issues.

Inferring dest from a single-dash long option

2 participants