tag:blogger.com,1999:blog-8733226863825522693.post8108603122772762345..comments2010-05-03T13:02:31.225-07:00Comments on ResultOf(Programming) = Moods.Happy: "Python Trick" % locals()thejoshwolfehttp://www.blogger.com/profile/12863300166734007945noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-8733226863825522693.post-56464793522641193812009-12-31T09:59:19.296-08:002009-12-31T09:59:19.296-08:00That does look a lot better. However, it's not...That does look a lot better. However, it's not available until Python 2.6. At work, I'm writing in Python 2.4.thejoshwolfehttps://www.blogger.com/profile/12863300166734007945noreply@blogger.comtag:blogger.com,1999:blog-8733226863825522693.post-17754386698849714192009-12-30T18:12:14.932-08:002009-12-30T18:12:14.932-08:00Thats the old way of string formatting, the new wa...Thats the old way of string formatting, the new way would be:<br /><br />return "gcc -c {switches} {sourcePath} -o {outputPath}".format(**locals())<br /><br />I much prefer the str.format function over the '"%s" % variable' methodRoy van de Waterhttps://www.blogger.com/profile/02563003669934978783noreply@blogger.com