R. David Murray added the comment:

FTR I agree with Antoine that returning the empty list is the more logical 
behavior here.  Wrap is turning a string into a list of lines...if there is no 
content, the list of lines *should* be empty, IMO.  That is what I would 
expect, so for me the empty list follows the principle of least surprise here.  
Consider, for example, the fact that [] is False, while [''] is True.  I 
consider that definitive in favor of returning an empty list when there is no 
content to wrap, even ignoring the backward compatibility issue.

The issue of preserving whitespace-only is fuzzier, but given that it is fuzzy 
I also am inclined to leave the current behavior alone (and document it 
properly).  As Antoine said, there is no point in preserving whitespace unless 
it is preserving indentation, and if there is nothing but whitespace there is 
nothing to be indented.

----------
nosy: +r.david.murray

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue15510>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to