Post #1350653
2026-04-16 00:46 UTC
Python Tip #105 (of 365):
When breaking a function call or list literal over multiple lines, use trailing commas.
For example, take this list:
fruits = [
"lemons",
"apples",
"watermelon",
]
Moving "lemons" to the end is easy when there's a trailing comma: just cut and paste.
Without trailing commas, moving "lemons" to the end means adding a comma after "watermelon" AND removing one after lemons.
🧵 (1/2)
#Python #DailyPythonTip
Replies (0)
No replies.