TLDR Web Dev · OPINIONS & ADVICE

THE PYTHONIC EMPTINESS

blog.codingconfessions.com15 min read

Summary from the TLDR Web Dev newsletter

Python's PEP-8 recommended method for checking empty sequences using truthiness (e.g., `if not mylist:`) is more Pythonic and efficient than using `len()`. While using `len()` isn't incorrect, the recommended Pythonic approach is simpler, faster, and clearer.