ANN: dedent 0.5 released

Christian Tismer tismer at
Thu Sep 29 09:52:13 EDT 2016

Dedent 0.5

What is it?

Dedent is a very simple tool for those people who like to
indent their inline code nicely.

For those who got already what it is, stop reading. :-)
All the others:

What is it, really?

Ok, think of some inline Python code, something like

$ python -c """some code"""

For very simple scripts, there is nothing wrong with it.
But for inline code over several lines, things become ugly:

$ python -c """
"The problem is that you have to start your"
"script very much on the left, although you"
"would probably like to indent it somehow."

One very ugly solution are constructs like """if True:
         "now I may indent the code"

This becomes even more ugly if you have to use the __future__
statement, which always must come first!

Now, here is what dedent does for you, simply that, not less
and not more:

$ python -m dedent """
         from __future__ import print_function

         "now I can really indent my code, because"
         "the dedent module takes care of the indent,"
         "and that was my intent. :-)"


$ pip install dedent

That's all, folks! Have fun.

p.s.: Why is that not build in by default?

Christian Tismer             :^)   tismer at
Software Consulting          :
Karl-Liebknecht-Str. 121     :
14482 Potsdam                :     GPG key -> 0xFB7BEE0E
phone +49 173 24 18 776  fax +49 (30) 700143-0023

More information about the Python-announce-list mailing list