Python CLI-Parser improvement for "one of those options"
Okay, I found a better way

import argparse
parser = argparse.ArgumentParser()

class RequiredLen(argparse.Action):
        def __call__(self, parser, args, values, option_string=None):
            if not 1 &lt;= len(values) &lt;= 2:
                msg = f"argument {self.dest} requires 1 or 2 arguments"
                raise argparse.ArgumentTypeError(msg)
            setattr(args, self.dest, values)
# Just give me 1 or 2 files
parser.add_argument(
    "--paired",
    nargs    = '+',
    action   = RequiredLen,
    required = True,
    help     = "input file(s)"
)
# Specify either ext1 or ext2 format
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument(
    "--ext1",
    action = "store_const",
    dest   = "format",
    const  = "ext1",
    help   = "input is ext1 format"
)
group.add_argument(
    "--ext2",
    action = "store_const",
    dest   = "format",
    const  = "ext2",
    help   = "input is ext2 format"
)
args = parser.parse_args()
print(args)


This way I can later just use something like:

def process_ext1(l: list):
   print("ext1 file(s)")
   for i in l:
       print(i)

def process_ext2(l: list):
   print("ext2 file(s)")
   for i in l:
       print(i)

process_format = { 'ext1': process_ext1, 'ext2': process_ext2 }
process_format[args.format](args.paired)