3 ms·
There's a pattern I have developed for my python scripts of writing a object like that : # where a and b are functions FOO = { a.__name__: a, b.__name_
by jrimbault 6y ago
There's a pattern I have developed for my python scripts of writing a object like that :
# where a and b are functions
FOO = { a.__name__: a, b.__name__: b }
and with argparse do
parser = argparse.ArgumentParser()
parser.add_argument(
"-f",
"--foo",
choices=FOO.keys(),
default=next(iter(FOO)),
help="choose your type of foo",
)
- anitil 6y agoI quite like that!