[Announce] Module indent.py - Indents and dedents bocks of text, %(<key>)s-style block indent

Wolfgang Grafen wolfgang.grafen at marconi.com
Mon Oct 1 04:34:46 EDT 2001


I tried to announce this module 2 times in comp.lang.python.announce
but it has not appeared. Does anybody know why?
*********************************************************************

Module indent.py: 

Indents and dedents bocks of text, %(<key>)s-style block indent

The indent module is useful for writing code generators. Templates are
a very often used for this but the '%(<key>)s' style text substitution 
produces fuzzy indented code unless the key is in the first position of
the  line. This makes visual inspection of the generated code difficult
and often individual helper functions are used to get around this problem.

The indent module provides three functions:
    (1) template: wraps a string object for '%(<key>)s style text 
                  substitution and thus fixes the oddity of the Python                         string object that it does not indent text correctly 
                  in this way.

    (2) indent:   indent a text for n spaces

    (3) dedent:   - strip spaces from the beginning of the line(s)
                  - maximum dedent for text block
                  - strip n_spaces from text block


Download available from 
        http://home.nexgo.de/wolfgang.grafen/Python/Modules/indent-0.1.zip

Wolfgang
----------------------------------------------------------------------
mailto:WolfgangGrafen at gmx.de



More information about the Python-list mailing list