> Duncan Booth wrote: > > > print "There are"+number+"ways to skin a"+furryanimal > > > > or at least something equivalent to it. If I try to make > the same mistake > > with a format string it jumps out to me as wrong: > > > > "There are%sways to skin a%s" % (number, furryanimal) > > Related to this, formatting with sequences is also much more readable > when there are complex interpunction and quoting characters present, > like this: > > print "'"+var1+"','"+var2'"+","+var3 > > the above is much more readable as > > print "'%s', '%s', %s" % (var1, var2, var3)
Hmm, with my hastily written contrived example, I had forgotten about sequences like that. Oddly, in the case above I prefer reading the bottom example, And shouldn't that top one be print "'"+var1+"','"+var2+"',"+var3 ;) So to conclude, in future I will read it, and see how readable it is before I decide. But now at least I do see a reason not to pathalogically avoid such string formatting :) Matt. This email is confidential and may be privileged. If you are not the intended recipient please notify the sender immediately and delete the email from your computer. You should not copy the email, use it for any purpose or disclose its contents to any other person. Please note that any views or opinions presented in this email may be personal to the author and do not necessarily represent the views or opinions of Digica. It is the responsibility of the recipient to check this email for the presence of viruses. Digica accepts no liability for any damage caused by any virus transmitted by this email. UK: Phoenix House, Colliers Way, Nottingham, NG8 6AT UK Reception Tel: + 44 (0) 115 977 1177 Support Centre: 0845 607 7070 Fax: + 44 (0) 115 977 7000 http://www.digica.com SOUTH AFRICA: Building 3, Parc du Cap, Mispel Road, Bellville, 7535, South Africa Tel: + 27 (0) 21 957 4900 Fax: + 27 (0) 21 948 3135 http://www.digica.com -- http://mail.python.org/mailman/listinfo/python-list