[issue9399] Provide a 'print' action for argparse
report at bugs.python.org
Fri Feb 4 02:47:13 CET 2011
Éric Araujo <merwok at netwok.org> added the comment:
Thanks for the new patch. It does not apply cleanly to the py3k branch, but that’s very easily corrected.
Could be replaced by
print will use the right EOL for the platform and is just coooler.
By the way, self.file should not be rebound in __call__:
if self.file is None:
self.file = _sys.stdout
file = (self.file if self.file is not None else _sys.stdout)
> Second, there are cases where you want whitespaces to be preserved,
> like printing out the license of your program (as I mentioned in my
> first post) Just look at this BSD license: [...]
> This is just plain ugly.
Agreed, but I did not suggest that the output be like that. In my previous message, I suggested that argparse could replace \n with spaces and do its own line wrapping, to adapt to terminal length while avoiding chunking ugliness. That’s Steven’s call anyway, I don’t have any strong feeling in favor of preserving whitespace or rewrapping. If argparse wraps lines to the terminal width in other cases (like with epilog text), I think it should do so here too.
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list