Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python.announce > #2266

ANN: dedent 0.5 released

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Christian Tismer <tismer@stackless.com>
Newsgroups comp.lang.python.announce
Subject ANN: dedent 0.5 released
Date Thu, 29 Sep 2016 15:52:13 +0200
Lines 62
Approved python-announce-list@python.org
Message-ID <mailman.0.1475161536.4212.python-announce-list@python.org> (permalink)
References <6efc4a42-4855-470f-033e-f57e16e32df8@stackless.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-Trace news.uni-berlin.de G+JC2IjCdTCE35BNwA0ekARNzvfQEMYPt9x/mN/plPZA==
Return-Path <tismer@stackless.com>
X-Original-To python-announce-list@python.org
Delivered-To python-announce-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; '-----------': 0.04; '"""': 0.05; 'lines,': 0.05; 'url:github': 0.05; '------------': 0.07; 'subject:ANN': 0.07; 'subject:released': 0.07; 'ugly': 0.07; '173': 0.09; '__future__': 0.09; 'gpg': 0.09; 'scripts,': 0.09; 'tismer': 0.09; 'python': 0.09; ':-)': 0.11; '"""if': 0.16; '776': 0.16; '==========': 0.16; 'constructs': 0.16; 'folks!': 0.16; 'from:addr:stackless.com': 0.16; 'from:addr:tismer': 0.16; 'from:name:christian tismer': 0.16; 'left,': 0.16; 'message- id:@stackless.com': 0.16; 'really?': 0.16; 'received:stackless.com': 0.16; 'true:': 0.16; 'url:stackless': 0.16; 'you"': 0.16; 'all,': 0.21; 'to:2**1': 0.21; 'code,': 0.23; 'module': 0.23; 'install': 0.25; 'import': 0.25; 'installation': 0.26; 'header:User-Agent:1': 0.27; 'becomes': 0.27; '0.5': 0.29; 'code"': 0.29; 'to:no real name:2**1': 0.29; 'code': 0.30; '+49': 0.30; 'probably': 0.31; '"the': 0.32; 'problem': 0.32; 'something': 0.33; 'really': 0.33; 'tool': 0.34; 'but': 0.34; 'that,': 0.35; 'subject:: ': 0.35; 'wrong': 0.35; 'skip:- 10': 0.36; 'things': 0.36; 'there': 0.36; 'received:io': 0.36; 'received:psf.io': 0.36; 'received:ams1.psf.io': 0.36; 'received:mail1.ams1.psf.io': 0.36; 'takes': 0.38; 'christian': 0.38; 'it?': 0.38; 'does': 0.38; 'why': 0.38; 'received:de': 0.38; 'to:addr:python-list': 0.38; 'some': 0.39; 'several': 0.39; 'proto:https': 0.39; 'to:addr:python.org': 0.39; 'software': 0.40; 'more': 0.62; 'here': 0.65; 'received:176': 0.66; 'statement,': 0.66; 'to:addr:python-announce-list': 0.66; 'inline': 0.67; 'phone': 0.67; 'default?': 0.84; 'nicely.': 0.84; 'others:': 0.84; 'p.s.:': 0.84; 'received:176.9': 0.84; 'received:176.9.65': 0.84; 'more:': 0.91
User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.3.0
X-Mailman-Approved-At Thu, 29 Sep 2016 11:05:35 -0400
X-BeenThere python-announce-list@python.org
X-Mailman-Version 2.1.23
Precedence list
List-Id Announcement-only list for the Python programming language <python-announce-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-announce-list>, <mailto:python-announce-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-announce-list/>
List-Post <mailto:python-announce-list@python.org>
List-Help <mailto:python-announce-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-announce-list>, <mailto:python-announce-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <6efc4a42-4855-470f-033e-f57e16e32df8@stackless.com>
Xref csiph.com comp.lang.python.announce:2266

Show key headers only | View raw


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. :-)"
         """

Installation
------------

$ pip install dedent


That's all, folks! Have fun.


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

-- 
Christian Tismer             :^)   tismer@stackless.com
Software Consulting          :     http://www.stackless.com/
Karl-Liebknecht-Str. 121     :     https://github.com/PySide
14482 Potsdam                :     GPG key -> 0xFB7BEE0E
phone +49 173 24 18 776  fax +49 (30) 700143-0023

Back to comp.lang.python.announce | Previous | Next | Find similar | Unroll thread


Thread

ANN: dedent 0.5 released Christian Tismer <tismer@stackless.com> - 2016-09-29 15:52 +0200

csiph-web