Skip to content

Conversation

adamchainz
Copy link
Member

Similar to #15185 , use improvements to Python function signatures where possible. Much of the x = options['x'] pattern has been around since Python 2.

@felixxm
Copy link
Member

felixxm commented Dec 13, 2021

@adamchainz Thanks for this patch 👍 However, is there any reason for this change, except the signature change? Is it backward compatible? Folks use subclasses of builtin commands. Currently I don't see much value in changing these signature.

@adamchainz
Copy link
Member Author

I tried sure to be backwards compatible everywhere, sticking with names and not extracting them if **options is passed on.

IMO it's easier to read, and sets examples for how to write management commands efficiently.

It's also better for mistakes where the argparse names don't align with the expected arguments. The error will happen at call time, rather than halfway through handle() when the options['x'] line is finally hit.

@adamchainz adamchainz closed this Feb 25, 2024
@adamchainz adamchainz deleted the command_arguments branch February 25, 2024 21:04
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.

2 participants