Alternate indent proposal for python 3000

Terry Reedy tjreedy at
Mon Apr 21 02:04:22 CEST 2008

"Matthew Woodcraft" <mattheww at> wrote in message 
news:hLC*ZjUas at
| Terry Reedy <tjreedy at> wrote:
| > But you do not really need a variant.  Just define a preprocessor
| > function 'blockify' which converts code in an alternate syntax to
| > regular indented block syntax.  Then
| >
| > exec(blockify(alt_code_string))
| You can do it like that, but if it were to become part of the standard
| distribution it would be nice to avoid having to tokenise the code
| twice.

For the motivating example I was responding to -- short snippets of code in 
html/xml/etc, that is completely a non-issue.

Any such scheme is very unlikely to become part of the stdlib and if it 
were, it would have to first be tested and beat out competitors.  A 
preprocessor written in Python is the obvious way to test and gain 

| (You could define the new block scheme in such a way that
| 'blockify' doesn't need to tokenise,

Off the top of my head: copy C and use {} to demarcate blocks and ';' to 
end statements, so that '\n' is not needed and is just whitespace when 
present.  So, repeatedly scan for the next one of '{};'.

| but I think it would end up a bit ugly.)

For beautiful, stick with standard Python.

Terry Jan Reedy

More information about the Python-list mailing list