In article <4dfe10d1$0$28053$426a3...@news.free.fr>, candide <candide@free.invalid> wrote:
> OK, thanks for your explanation, it was just stringisation ! > > > I erroneously focused on > > +x+ > > as a kind of placeholder unknown to me, instead of left and right > concatenations ;) > > It would be more readable for me if it were edited > > >>> print '"' + x + '"' # better spacing > "foo" > >>> > > or with string formatting : > > >>> x="foo" > >>> print '"%s"' %x > "foo" > >>> This is one of the (very) few places PHP wins over Python. In PHP, I would write this as print "'$x'" which seems easier to read than any of the Python versions. Of course, sharp-eyed readers will notice that I inverted the single and double quotes because print '"$x"' doesn't work. If you really wanted to replicate the output exactly, you would have to do print "\"$x\"" by which time you'd probably run back to writing it in Python :-) -- http://mail.python.org/mailman/listinfo/python-list