Temporary Permanence

Temporary Permanence

Lukas Vacula's personal website and blog.

02 Oct 23

python `or [default]`

Did you know that you can use the “or” keyword in python to set a “default” for a variable?

variable_name = value_or_none() or "default value!" 

Over five years since I started using Python, and I’m only learning this now. I wish I knew about it sooner.