Daniel Daniel - 4 months ago 18
Python Question

How to break long lines in python that have no brackets or operators?

This is different from similar questions I have found on this site as the code in question doesn't have any operators or brackets before the character limit to split easily on. I have several long lines in python without operators or brackets before 79 characters. As an example:


The above line has 72 characters before a bracket, and is within a function definition within a class so therefore with 4-char spacing per nest level, has 81 characters before a bracket.

What is the preferred way of dealing with this?


With your particular example, I expect if you first solved the problem of "make this code readable", fitting in 79 characters would come naturally.

That said, you can add brackets: