[Python-ideas] Simplifying .format() based string interpolation
Robert Hölzl
robert.hoelzl at posteo.de
Fri Feb 7 02:32:44 CET 2014
Haoyi Li <haoyi.sg at ...> writes:
>
> It already works!
>
>
> from macropy.string_interp import macros, s
> A = 10
> B = 5
> print s["{A} + {B} = {A + B}"]
> # 10 + 5 = 15
I checked out macropy and seems to be really funny.
It is kind a bringing LISP (which all its power to modify
the language by itself) to Python.
But nevertheless, this solution is not pythonic
(as least as long as the python community did not
decide to include macropy and use it as inherent
as macros are used in LISP)
Furthermore I do NOT want {A+B} to work, since this
would be PHP. I would like to use the pythonic .format()
Robert
More information about the Python-ideas
mailing list