"Matthew Woodcraft" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
| Terry Reedy <[EMAIL PROTECTED]> 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
acceptance.
| (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
--
http://mail.python.org/mailman/listinfo/python-list