R
Roy Smith
As I read the docs (http://tinyurl.com/3ww9scr), the following two calls
should result in the same object:
parser = argparse.ArgumentParser(description="blah")
parser = argparse.ArgumentParser("blah")
In the first case, I'm explicitly setting description to "blah", in the
second case, I'm passing "blah" as a positional parameter so it should
be taken as first parameter to the function, which happens to be
description. Either way should end up the same.
I don't, however, get the same behavior when run with "-h". The first
gives what I would expect:
------------------------------------------------
usage: arg.py [-h]
blah
optional arguments:
-h, --help show this help message and exit
should result in the same object:
parser = argparse.ArgumentParser(description="blah")
parser = argparse.ArgumentParser("blah")
In the first case, I'm explicitly setting description to "blah", in the
second case, I'm passing "blah" as a positional parameter so it should
be taken as first parameter to the function, which happens to be
description. Either way should end up the same.
I don't, however, get the same behavior when run with "-h". The first
gives what I would expect:
------------------------------------------------
usage: arg.py [-h]
blah
optional arguments:
-h, --help show this help message and exit