textwrap.dedent replaces tabs?

Tom Plunket tomas at fancy.org
Thu Dec 28 23:51:47 EST 2006


Frederic Rentsch wrote:

> Your rules seem incomplete.

Not my rules, the stated documentation for dedent.  "My" understanding
of them may not be equivalent to yours, however.

> What if common tabs remain after stripping common white space?

What if we just go with, "[r]emove any whitespace than can be uniformly
removed from the left of every line in `text`." ?

> Does this never happen? Or can we hope it doesn't happen?

"Hope" has no place in programming software that is to be used by
others.

> To err on the side of caution I complete your rules and this is my 
> (tested) attempt at expressing them pythonically.

Inasmuch as "my" rules have been expressed via tests, the provided code
fails four of the five tests provided.

> (I admit it does look awfully sevety-ish. Just a vulgar little 
> function.)

Seventys-ish is as much a statement about the lack of statement about
how you actually tested it as it is that an implementation was made
apparently without understanding of the requirements.


-tom!

-- 



More information about the Python-list mailing list