Skip to content

Entries published in January 2020

2 entries published in this month. See also: all entries published in 2020, latest entries.

Having some fun with Python

The other day on a Slack I hang out in, someone posted an amusing line of Python code:

port = "{port}:{port}".format(port=port)

If it’s not clear after the inevitable Swedish-chef-muppet impression has run through your mind, this string-formatting operation will replace the contents of port with a string containing two copies of whatever was in port, separated by a colon. So if port was "foo", now it will be "foo:foo".

Someone of course suggested using f-strings for a more readable version:

port = …

Entry published January 20, 2020. Read full entry.

A Python Packaging Carol

I have endeavoured in this Ghostly little book, to raise the Ghost of an Idea, which shall not put my readers out of humour with themselves, with each other, with the season, or with me. May it haunt their houses pleasantly, and no one wish to lay it.

Every year around Christmas, I make a point of re-reading Charles Dickens’ A Christmas Carol. If you’ve only ever been exposed to the story through adaptations into other media, I highly recommend getting a copy of Dickens’ original text (it’s public domain …

Entry published January 5, 2020. Read full entry.