News for hackers. Stuff that matters.
Re:New string formatting in Python by soheil on Sunday January 03, 2016 @07:52PM (#10833422)
Am I crazy or PHP had this feature since forever? String templates can significantly improve programming speed specially for those of us who are keyboard impaired. Not having to remember how many %s' you need or if one of them should be %d and so on may to most seem just knit picking but personally it makes a day and night difference.
Re:New string formatting in Python by MereInterest on Sunday January 03, 2016 @08:41PM (#10833574)
PHP has had it forever. Given PHP's reputation, I'm not sure if that is a good argument for this feature. Rather than '%s' and '%d', why not just use '{}' and '.format'? That way, each argument is converted to a string appropriately. If it becomes confusing with many arguments, it is easy to name the parameters '{myparam}'