alternatives to making blocks like { } or other ??

Ville Vainio ville at spammers.com
Sat May 22 07:21:23 EDT 2004


>>>>> "Mel" == Mel Wilson <mwilson at the-wire.com> writes:

    Mel> The best solution would be for somebody to volunteer to
    Mel> write a program that would take Python source, marked up
    Mel> with block brackets (perhaps '##{' and '##}', perhaps not)
    Mel> and create properly indented Python.  If you volunteered for

It already exists in Python - it's the Tools/Scripts/pindent.py
script.

Here's the copy-pastage of the way code is written, for those who
don't care enough to check:

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

-- 
Ville Vainio   http://tinyurl.com/2prnb



More information about the Python-list mailing list