The one-liner would indeed be much nicer! Thanks for pointing this out. I definitely want to start using `setdefault` more.