Re: argsparse: allowing --version without mandatory options

Daniel Sommers <[email protected]>
Newsgroups gmane.comp.python.general
Message-ID <aQUjBSBfL83vruIT@anomaly>
On 2025-10-31 at 09:09:08 +0000,
Anders Munch <[email protected]> wrote:

> From: [email protected] <[email protected]>:
> > Don't take this the wrong way, but what, exactly, is a mandatory option?
> 
> It's a named argument.

Okay.

> Positional arguments intermixed with options can get confusing. When you see 
>      aprogram.py --a --b c --d --e
> is 'c' the value for --b, or is it a positional argument? Hard to tell.
> Using options syntax for everything makes it clearer, because everything has a name:
>      aprogram.py --a --b --c c --d --e

Is 'c' the value for --c, or is it a positional argument?  Hard to tell.

Perhaps it would be easier to tell with non-degenerate names.

Perhaps not.

Or maybe if I understood all the use cases for aprogram.py.  But if I
truly understood the all use cases, and the use case I was using in
particular, then I would understand the options and arguments, named,
unnamed, optional, or mandatory.

APIs are easy to create, and hard to get right.
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.