-
-
Save nanaze/db63e3f63e318408e3223bf1245d9752 to your computer and use it in GitHub Desktop.
Demonstrate strange argpase behavior
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# argparse demo | |
import argparse | |
def _GetParser(): | |
parser = argparse.ArgumentParser() | |
parser.add_argument('--foo', type=bool, default=False) | |
return parser | |
def _PrintArgParse(args): | |
print 'args:', args | |
parser = _GetParser() | |
args = parser.parse_known_args(args) | |
print args | |
def main(): | |
_PrintArgParse(['--foo=True']) | |
_PrintArgParse(['--foo=False']) | |
if __name__ == '__main__': | |
main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Command output: