The benefits of trailing commas PREMIUM

Trey Hunner smiling in a t-shirt against a yellow wall
Trey Hunner
5 minute read Python 3.7—3.10
Python Morsels
Watch as video
03:01

Let's talk about trailing commas in Python.

What's a trailing comma?

When I'm make a multi-line list, dictionary, tuple or function call (see wrap a long line in Python), I prefer to put the closing bracket or brace on its own line:

...

A Python Tip Every Week

Need to fill-in gaps in your Python skills? I send weekly emails designed to do just that.