On 2025-10-30 13:47:16 -0400, [email protected] wrote: > On 2025-10-30 at 13:50:42 +0100, > Loris Bennett <[email protected]> wrote: > > "Loris Bennett" <[email protected]> writes: > > > I am writing a program for the command-line which uses 'argsparse'. I > > > want to make some options mandatory by setting 'required=True', but [...] > Don't take this the wrong way, but what, exactly, is a mandatory option? > Mandatory and optional are quite opposite. If you have mandatory > arguments, then make the arguments mandatory. If you have optional > options, then make the options optional. Otherwise, as a user, I just > have extra typing (i.e., the "--whatever" before the mandatory argument) > to type (redundancy intended).
As a user, you also get safety from that redundancy. It's easy to mix
up the order of positional arguments, especially if there are more than
two or three of them. If you have to name each argument, that risk is
significantly reduced.
hjp
--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | [email protected] | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"
signature.asc
Description: PGP signature
-- https://mail.python.org/mailman3//lists/python-list.python.org
