En Sun, 20 Apr 2008 13:42:05 -0300, Matthew Woodcraft <[EMAIL PROTECTED]> 
escribió:

> An alternative scheme for describing the block structure could be
> useful in other cases, though. For example, if you wanted to support
> putting snippets of Python in configuration files, or spreadsheet
> cells.
> [...] If someone wrote a library for this and it proved popular, I expect it
> would be considered for the standard library.

There is "pindent.py" in the Tools/scripts directory:

# ... When called as "pindent -r" it assumes its input is a
# Python program with block-closing comments but with its indentation
# messed up, and outputs a properly indented version.

# A "block-closing comment" is a comment of the form '# end <keyword>'
# where <keyword> is the keyword that opened the block ...

def foobar(a, b):
    if a == b:
        a = a+1
    elif a < b:
        b = b-1
        if b > a: a = a-1
        # end if
    else:
        print 'oops!'
    # end if
# end def foobar

-- 
Gabriel Genellina

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to