[Python-3000] String formating operations in python 3k
Ian Bicking
ianb at colorstudy.com
Tue Apr 4 17:41:39 CEST 2006
Georg Brandl wrote:
> Greg Ewing wrote:
>
>>Barry Warsaw wrote:
>>
>>
>>>I don't much like the $"" prefix
>>
>>This was discussed during the last round of formatting
>>wars, and the conclusion was that having $ both
>>inside and outside the string would be too visually
>>confusing.
>
>
> Another issue is that current string prefixes act at parse time
> while the $ prefix would act at runtime.
A $ prefix would act at parse time, i.e., $"answer: $answer" would be
equivalent to ("answer: " + str(answer)). like r and u, $ would change
the meaning of the literal, it wouldn't be an operator, and so this
would be a syntax error:
answer = 1
msg = "answer: $answer"
print $msg
Though I also agree that $"answer: $answer" introduces a confusing
number of $'s.
--
Ian Bicking / ianb at colorstudy.com / http://blog.ianbicking.org
More information about the Python-3000
mailing list