[Python-Dev] PEP 215 redux: toward a simplified consensus?
Greg Ewing
greg@cosc.canterbury.ac.nz
Tue, 26 Feb 2002 15:14:10 +1300 (NZDT)
I'm not sure I like the idea of using $ as the character
for prefixing interpolated strings. Somehow
a = $"My name is $name"
looks confusing. I think it has something to do with the
fact that $ is appearing both inside and outside the
quotes, making my visual parser worry that the quotes
are misplaced.
Also, it uses up one of the three precious not-yet-used
characters, and I think we should keep those for some
future time when we really need them. We don't need one
for this -- there are plenty of operators available
that haven't yet been used on strings.
I suggest '^', since it does a nice job of suggesting
"inject stuff into this string". We can have both a
prefix form for compile-time interpolation:
a = ^ "My name is $name"
and an infix form for run-time interpolation:
a = "My name is $name" ^ dict
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury, | A citizen of NewZealandCorp, a |
Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. |
greg@cosc.canterbury.ac.nz +--------------------------------------+