{"id":7228,"date":"2018-05-27T12:59:02","date_gmt":"2018-05-27T16:59:02","guid":{"rendered":"http:\/\/irreal.org\/blog\/?p=7228"},"modified":"2018-05-27T13:12:31","modified_gmt":"2018-05-27T17:12:31","slug":"f-strings-in-elisp","status":"publish","type":"post","link":"https:\/\/irreal.org\/blog\/?p=7228","title":{"rendered":"f-strings in Elisp"},"content":{"rendered":"<p> John Kitchin, as you probably know, is a fan of Python as well as of Emacs. One of the things he really likes in Python 3 is f-strings. They allow you to do things like\n<\/p>\n<div class=\"org-src-container\">\n<pre class=\"src src-python\"><span style=\"color: #a020f0;\">import<\/span> datetime\r\n<span style=\"color: #a0522d;\">today<\/span>=datetime.datetime.today()\r\n<span style=\"color: #a0522d;\">name<\/span>=<span style=\"color: #8b2252;\">\"J. Random User\"<\/span>\r\n<span style=\"color: #a020f0;\">print<\/span> (f<span style=\"color: #8b2252;\">'{name:14s} signed up for Bozoid Services on {today}'<\/span>)\r\n<\/pre>\n<\/div>\n<p> You may or may not like the idea but if you do and you&rsquo;re an Elisp programmer, Kitchen has a <a href=\"http:\/\/kitchingroup.cheme.cmu.edu\/blog\/2018\/05\/14\/f-strings-in-emacs-lisp\/\">simple implementation in Elisp<\/a>. They&rsquo;re not quite as powerful as Python&rsquo;s but Kitchin says they do what he usually needs them to do. <\/p>\n<p> Unless you&rsquo;re in the camp that eschews the loop macro and format strings on the grounds that they&rsquo;re &ldquo;unlisp-like&rdquo; you may want to try it out. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>John Kitchin, as you probably know, is a fan of Python as well as of Emacs. One of the things he really likes in Python 3 is f-strings. They allow you to do things like import datetime today=datetime.datetime.today() name=&#8221;J. Random &hellip; <a href=\"https:\/\/irreal.org\/blog\/?p=7228\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[18],"class_list":["post-7228","post","type-post","status-publish","format-standard","hentry","category-general","tag-emacs"],"_links":{"self":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/7228","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7228"}],"version-history":[{"count":4,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/7228\/revisions"}],"predecessor-version":[{"id":7232,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/7228\/revisions\/7232"}],"wp:attachment":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7228"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7228"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7228"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}