Breaking up long lines of code in Python

Опубликовано: 17 Февраль 2026
на канале: Python Morsels
6,749
73

Have a long line of Python code? If you don't have brackets or braces on your line yet, you can add parentheses wherever you'd like and put line breaks within them. PEP 8, the official Python style guide, calls this "implicit line continuation".

Read an article version of this video at https://pym.dev/breaking-long-lines-c...

Find more Python screencasts at https://pym.dev/screencasts/

00:00 How to continue code on the next line
00:58 Alignment is a personal preference
01:30 Function calls already have parentheses
01:45 Implicit line continuations work for all kinds of brackets and braces
02:14 Code auto-formatters can help
02:30 Recap