textwrap.dedent() drops tabs - bug or feature?

Peter Hansen peter at engcorp.com
Fri Nov 18 22:31:03 EST 2005


Steven Bethard wrote:
> Note that even though the tabs are internal, they are still removed by 
> textwrap.dedent().  The documentation[1] says:
...
> So it looks to me like even if this is a "feature" it is undocumented. 
> I'm planning on filing a bug report, but I wanted to check here first in 
> case I'm just smoking something.

While I wouldn't say it's obvious, I believe it is (indirectly?) 
documented and deliberate.

Search for this in the docs:
"""
expand_tabs
     (default: True) If true, then all tab characters in text will be 
expanded to spaces using the expandtabs() method of text.
"""

(This is not to say a specific rewording of the docs to lessen any 
confusion in this area wouldn't be welcomed.)

-Peter



More information about the Python-list mailing list