Alternate indent proposal for python 3000
Terry Reedy
tjreedy at udel.edu
Sun Apr 20 13:24:42 EDT 2008
"Matthew Woodcraft" <mattheww at chiark.greenend.org.uk> wrote in message
news:X0A*xYTas at news.chiark.greenend.org.uk...
| There's no need to support the new scheme in .py files, so it seems to
| me that this doesn't have to be done in the core language. All that's
| needed is a variant of 'eval' which expects the alternate scheme, and
| that could be prototyped just using text manipulation and the normal
| 'eval'.
Eval() is for expressions, exec() is for general code. 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))
I presume that this is more or less what the templating engines do.
More information about the Python-list
mailing list