Message166815
While working on issue 1859, I noticed that textwrap.wrap()'s tab expansion does not seem to behave sensibly.
In particular, the documentation says, "If expand_tabs is true, then all tab characters in text will be expanded to zero or more spaces, *depending on the current column* and the given tab size."
The problem is that tab expansion is done as the first stage (and in particular, before wrapping), which means that "the current column" is no longer current after wrapping. This leads to results like--
from textwrap import wrap
text = ("a\tb "
"a\tb")
lines = wrap(text, width=5, tabsize=4)
for line in lines:
print(repr(line))
Output:
'a b'
'a b'
One would expect tab expansion to occur after (or while) wrapping, so that tab stops line up in the wrapped output. |
|
Date |
User |
Action |
Args |
2012-07-29 21:11:57 | chris.jerdonek | set | recipients:
+ chris.jerdonek |
2012-07-29 21:11:57 | chris.jerdonek | set | messageid: <1343596317.09.0.0346303694102.issue15492@psf.upfronthosting.co.za> |
2012-07-29 21:11:56 | chris.jerdonek | link | issue15492 messages |
2012-07-29 21:11:56 | chris.jerdonek | create | |
|