Éric Araujo <mer...@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.


        self.file.write(self.message)
        self.file.write('\n')

Could be replaced by
        print(self.message, file=self.file)

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 <rep...@bugs.python.org>
<http://bugs.python.org/issue9399>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to