{"action":"created","issue":{"url":"https://api.github.com/repos/servo/servo/issues/8857","labels_url":"https://api.github.com/repos/servo/servo/issues/8857/labels{/name}","comments_url":"https://api.github.com/repos/servo/servo/issues/8857/comments","events_url":"https://api.github.com/repos/servo/servo/issues/8857/events","html_url":"https://github.com/servo/servo/issues/8857","id":120642931,"number":8857,"title":"Replace 'string.Template(..).substitute(..)' usage with 'str.format'","user":{"login":"frewsxcv","id":416575,"avatar_url":"https://avatars.githubusercontent.com/u/416575?v=3","gravatar_id":"","url":"https://api.github.com/users/frewsxcv","html_url":"https://github.com/frewsxcv","followers_url":"https://api.github.com/users/frewsxcv/followers","following_url":"https://api.github.com/users/frewsxcv/following{/other_user}","gists_url":"https://api.github.com/users/frewsxcv/gists{/gist_id}","starred_url":"https://api.github.com/users/frewsxcv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frewsxcv/subscriptions","organizations_url":"https://api.github.com/users/frewsxcv/orgs","repos_url":"https://api.github.com/users/frewsxcv/repos","events_url":"https://api.github.com/users/frewsxcv/events{/privacy}","received_events_url":"https://api.github.com/users/frewsxcv/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/servo/servo/labels/C-assigned","name":"C-assigned","color":"02d7e1"},{"url":"https://api.github.com/repos/servo/servo/labels/E-easy","name":"E-easy","color":"02e10c"},{"url":"https://api.github.com/repos/servo/servo/labels/I-cleanup","name":"I-cleanup","color":"e11d21"},{"url":"https://api.github.com/repos/servo/servo/labels/L-python","name":"L-python","color":"bfd4f2"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2015-12-06T16:09:01Z","updated_at":"2015-12-17T02:27:25Z","closed_at":null,"body":"[`string.Template`](https://docs.python.org/2/library/string.html#template-strings) was introduced in Python 2.4. [`str.format`](https://docs.python.org/2/library/stdtypes.html#str.format) (a method on strings) was introduced in Python 2.6. Functionally, they are very similar, though the latter is less verbose.\r\n\r\ne.g.\r\n\r\n```python\r\nstring.Template(\"Hello ${arg}\").substitute({\"arg\": \"world!\")\r\n```\r\n\r\ncan be written as:\r\n\r\n\r\n```python\r\n\"Hello {arg}\".format(arg=\"world!\")\r\n\r\n# or\r\n\r\na = {\"arg\": \"world!\"}\r\n\"Hello {arg}\".format(**a)\r\n```\r\n\r\nTo find usages:\r\n\r\n```\r\n./mach grep string.Template\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/servo/servo/issues/comments/165317172","html_url":"https://github.com/servo/servo/issues/8857#issuecomment-165317172","issue_url":"https://api.github.com/repos/servo/servo/issues/8857","id":165317172,"user":{"login":"frewsxcv","id":416575,"avatar_url":"https://avatars.githubusercontent.com/u/416575?v=3","gravatar_id":"","url":"https://api.github.com/users/frewsxcv","html_url":"https://github.com/frewsxcv","followers_url":"https://api.github.com/users/frewsxcv/followers","following_url":"https://api.github.com/users/frewsxcv/following{/other_user}","gists_url":"https://api.github.com/users/frewsxcv/gists{/gist_id}","starred_url":"https://api.github.com/users/frewsxcv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frewsxcv/subscriptions","organizations_url":"https://api.github.com/users/frewsxcv/orgs","repos_url":"https://api.github.com/users/frewsxcv/repos","events_url":"https://api.github.com/users/frewsxcv/events{/privacy}","received_events_url":"https://api.github.com/users/frewsxcv/received_events","type":"User","site_admin":false},"created_at":"2015-12-17T02:27:25Z","updated_at":"2015-12-17T02:27:25Z","body":"I sort of agree with @ceph3us that they're not fun to work with. I think the Python strings should be as close as possible to the outputted Rust code. When writing new Python code in this file, I'm fairly certain people are going to commonly run into braces issues frequently via `str.format`. I overlooked this difference with how braces work between `string.Template` and `str.format` when I first filed this issue.\r\n\r\nThat said, I'm now skeptical of the benefits of completing this issue. @ceph3us since you've already edited the files a bit, you can make a suggestive call whether you think the changes make the code cleaner. Otherwise, I'm sorry for misleading you down this path. Thanks for the effort though!\r\n"}}