Steven Bethard <[email protected]> added the comment:
Should this print to stdout or stderr? I wonder if the API should allow either,
and instead look like:
parser.add_argument('--license', action='write', message='...', file=sys.stdout)
Where sys.stdout would be the default for the file= argument. The action would
then just literally call file.write(message), so the behavior would be pretty
easy to explain.
Of course, at that point it makes me wonder if maybe it wouldn't just be better
to have an easy way to have some arbitrary function called without having to
subclass Action, e.g.:
parser.add_argument('--license', action='call', callable=lambda:
sys.stdout.write(message))
Basically this would be a shorthand for subclassing Action when you don't need
any information about the command line.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue9399>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com