ThomasWaldmann / argparse

python argparse, pypi version (moved from google code)
Other
59 stars 18 forks source link

What does the comments "We have to allow for ..." means? #102

Closed cgsdfc closed 5 years ago

cgsdfc commented 5 years ago

https://github.com/ThomasWaldmann/argparse/blob/67f3ce3c9ad8442d1d4c43724ced5b9ac65faf77/argparse.py#L2177-L2180 The comment below the _get_nargs_pattern says

  # in all examples below, we have to allow for '--' args
  # which are represented as '-' in the pattern

and I can't figure it out. I am spending time to understand this piece of code so that I can make use of it. It sounds like special treatments are made to those pattern strings like '(-*A[A-]*)' because single dash and double dash are both represented as - in the the arg_string_pattern. Am I wrong? I understand the basic behind the scene -- an arg_string_pattern is built from the actual arg_strings and matched against the pattern built from nargs of an action. But like 'A' and 'O', dash can appear as many time as it likes because user can gave you -- -- - -, which became ---- in the arg_string_pattern. I can't see any relationship between this fact and the fact that double dash is represented as single dash. But the comments somehow implied such relationship.

So what information this piece of comment want to convey? Help!

ThomasWaldmann commented 5 years ago

Please read the README.txt, this is not the right place for argparse questions / discussion.

cgsdfc commented 5 years ago

Sorry. Maybe I should go to stackoverflow or somewhere.

ThomasWaldmann commented 5 years ago

bugs.python.org or so.