empy 1.3 -- Embed Python in template text as markup

Erik Max Francis max at alcyone.com
Mon Aug 26 08:33:47 CEST 2002

Neil Hodgson wrote:

>    Further expansions yield the same result with the same f or
> equivalent
> results with updated f.

I see what you're getting at now.  It seems straightforward enough that
I don't see much reason _not_ to implement it, but am not sure what
general appeal it might have.

>    The syntax given above is too likely to run into problems as a
> simple '!'
> is too likely to occur in the expression or expansion, so possibly
> some more
> '@' based tokens could be used like @!expr@~...@|

>From my examination the following symbols don't appear as legal tokens
in Python expressions (they might always appear in string literals, of
course, but that's easy enough to avoid):

	@ # $ : ; ?

Any of these can be used for delimiting expressions within a certain
construct.  As for delimiting the start of the construct itself, any
character can be used following the prefix (by default, @), except for
those already used by the system.

As you point out, ! would be a bad choice since it appears legally in
Python code.  (This discussion also made me just realize that @<... :
...> for try/catch like behavior with expressions was a mistake, since >
can appear perfectly legally in expressions ... no matter, I can
collapse it all into an uber-@( ... ) syntax.)

What would you suggest? @: ... : ... :?  It's something I would expect
only advanced users to need, so it's probably not a problem if it
doesn't look too pretty.

 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ There is nothing so subject to the inconstancy of fortune as war.
\__/ Miguel de Cervantes
    Church / http://www.alcyone.com/pyos/church/
 A lambda calculus explorer in Python.

More information about the Python-list mailing list