f-strings in Elisp

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="J. Random User"
print (f'{name:14s} signed up for Bozoid Services on {today}')

You may or may not like the idea but if you do and you’re an Elisp programmer, Kitchen has a simple implementation in Elisp. They’re not quite as powerful as Python’s but Kitchin says they do what he usually needs them to do.

Unless you’re in the camp that eschews the loop macro and format strings on the grounds that they’re “unlisp-like” you may want to try it out.

This entry was posted in General and tagged . Bookmark the permalink.