On 25/08/12 04:57, Daniel Holth wrote:
Yes, if I wanted to pretend I was using JavaScript.
I'm not entirely sure what you are responding to here -- the context is lost when you top post like that. I'm *guessing* that you are responding to Antoine's advice to use concatenation. If so, why do you think that concatenation is "pretending" to be using Javascript? It is a perfectly valid operation in Python, and many languages which predate Javascript include concatenation.
A string-only formatter might cause problems with translation string / gettext type objects?
On Fri, Aug 24, 2012 at 2:40 PM, Antoine Pitrou<solipsis@pitrou.net> wrote:
On Fri, 24 Aug 2012 14:33:48 -0400 Daniel Holth<dholth@gmail.com> wrote:
String only would be perfect. I only single out bytes because they are more like strings than any other type.
You can use concatenation instead of (or in addition to) formatting:
"" + "foo" 'foo' "" + b"foo" Traceback (most recent call last): File "<stdin>", line 1, in<module> TypeError: Can't convert 'bytes' object to str implicitly "" + 42 Traceback (most recent call last): File "<stdin>", line 1, in<module> TypeError: Can't convert 'int' object to str implicitly
Regards
Antoine.
-- Steven