Posts tagged: POSTS

Good questions from students

I love visiting high school and college classes to help students learn what it’s like to do software engineering professionally.

Recently I was a guest speaker in a local high school computer science class, and afterward got a great bunch of emails from the students.

Django management commands, remotely

Django management commands, remotely

I love Django management commands.

For dpaste.com I’ve written several management commands for things that I don’t need a web UI for, like:

  • expire - delete expired pastes (invoked by cron)
  • expunge - manage TOS violations like spam
  • stats - useful metrics on the current corpus of pastes, and on user activity

In running the site I also use management commands from my django-blocklist app, for tasks like deleting expired entries (via cron) or generating reports.

A use case for Python assignment expressions

Python 3.8 (2019) added “assignment expressions”, aka the “walrus operator”.

I generally like things that make Python more expression-oriented, like list comprehensions, but I’m ambivalent about these. It’s pretty easy to impair readability by using them overzealously. Is saving one line of code worth making it harder to notice that an assignment is happening?

However, I’ve found a use case I like a lot. I use them in the Django Python shell when doing exploratory ORM queries.

Blog comments via Mastodon

Blog comments via Mastodon

I’ve replaced my Disqus comment integration with a Mastodon-powered solution. On posts where I’ve enabled comments, you’ll now see a “Load Comments” button and a “Reply” button, both of which talk to the Mastodon API.

Adding commenting to a static site is an interesting puzzle.