-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Description
Hi, I have a function which takes a number of kwonlyargs and then arbitrary values (think file or directory names), like so:
import plac
def foo(*moo, gu=4, gac=None):
print(f"{gu=}\n{gac=}\n{moo=}\n")
if __name__ == '__main__':
plac.call(foo)
P = plac.parser_from(foo)
print(P.argspec)
P.print_help()this gives this output and seems to ignore the keyword-only arguments guand gac:
$ python .\plac_kwonlyargs.py --gu=77 foo bar
gu=4
gac=None
moo=('foo', 'bar', '--gu=77')
FullArgSpec(args=[], varargs='moo', varkw=None, defaults=None, kwonlyargs=['gu', 'gac'], kwonlydefaults={'gu': 4, 'gac': None}, annotations={})
usage: plac_kwonlyargs.py [-h] [moo ...]
positional arguments:
moo
options:
-h, --help show this help message and exitI'd expect the program to print
$ python .\plac_kwonlyargs.py --gu=77 foo bar
gu=77
gac=None
moo=('foo', 'bar')
FullArgSpec(args=[], varargs='moo', varkw=None, defaults=None, kwonlyargs=['gu', 'gac'], kwonlydefaults={'gu': 4, 'gac': None}, annotations={})
usage: plac_kwonlyargs.py [-h] [--gu=int] [--gac=Any] [moo ...]
positional arguments:
moo
gu [4]
gac []
options:
-h, --help show this help message and exitis this a pebcac on my side or intentional or a bug?
Metadata
Metadata
Assignees
Labels
No labels