Re: argsparse: allowing --version without mandatory options

Mats Wichmann <[email protected]>
Newsgroups gmane.comp.python.general
Message-ID <[email protected]>
On 10/30/25 11:47, [email protected] wrote:
> On 2025-10-30 at 13:50:42 +0100,

> Don't take this the wrong way, but what, exactly, is a mandatory option?
Perhaps an argument that must be given in order to specify a value that 
has no default (not that I'd do that, personally).

Or a word selecting a subcommand, where you *must* specify a command. 
Here you usually fall back to help if not given.

And, yes, --version already gets special handling in argparse, if you 
use the 'version' action.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.