[issue9399] Provide a 'print' action for argparse

Dennis Malcorps report at bugs.python.org
Thu Jul 29 17:22:23 CEST 2010


Dennis Malcorps <dennis.malcorps at googlemail.com> added the comment:

> parser.add_argument('--license', action='write', message='...', file=sys.stdout)
The ability to redirect the output would be a nice addition.

> parser.add_argument('--license', action='call', callable=lambda: sys.stdout.write(message)) 
optparse already has a 'callable' action, I had the impression it was left out of argparse on purpose, even tough I couldn't imagine why...

Either way is fine for me.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9399>
_______________________________________


More information about the Python-bugs-list mailing list