Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Whoa...I did a 'zcat /vmlinuz > /dev/audio' and I think I heard God... -- mikecd on #Linux


devel / comp.lang.python / argparse - 3rd arg only valid for one of two mutually exclusive args?

SubjectAuthor
o argparse - 3rd arg only valid for one of two mutually exclusive args?Loris Bennett

1
argparse - 3rd arg only valid for one of two mutually exclusive args?

<87o871h0w8.fsf@hornfels.zedat.fu-berlin.de>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15901&group=comp.lang.python#15901

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: loris.be...@fu-berlin.de (Loris Bennett)
Newsgroups: comp.lang.python
Subject: argparse - 3rd arg only valid for one of two mutually exclusive args?
Date: Wed, 03 Nov 2021 13:36:07 +0100
Organization: Freie Universitaet Berlin
Lines: 22
Message-ID: <87o871h0w8.fsf@hornfels.zedat.fu-berlin.de>
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: news.uni-berlin.de Ym3BEFf74uQum4aC6LCi8QN2MlzLoS2WQwciWIQcvrBSdA
Cancel-Lock: sha1:a9v2cwLL+9cf/uVe4oFTH1Asyow=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
 by: Loris Bennett - Wed, 3 Nov 2021 12:36 UTC

Hi,

With argparse's add_mutually_exclusive_group() I can add mutually
exclusive args, but how do I deal with a 3rd arg which only makes sense
for one of the mutually exclusive args?

More generally I suppose I am interested in having something like

[ --foo (--foobar) | --bar (--barfoo) ]

if that makes it any clearer.

I have seen subcommand suggested as a way of doing this, but that
doesn't seem like a very good fit for my use-case. Is there a more
argument-orientated alternative?

Cheers,

Loris

--
This signature is currently under construction.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor