I’m using argparse (Python 3.2). A parameter mode is defined simply as:
p.add_argument('--mode', dest='mode')
I want to call the program from the command line in such a way that parameter mode is set to an empty string; or at least to a single space ' ' (I can strip whitespace later).
I tried to use (under Windows) program_name --mode "" and program_name --mode " ", but neither worked.
This seems to work for me under OS-X:
and then:
I don’t have a windows machine, so I don’t know anything about how those operate…
Of course, the other things you mentioned above would work as well on OS-X. The advantage here is that it shouldn’t rely on how the shell splits arguments enclosed in quotations which should make it work in more places I would think.