According to PEP8, should I always break my lines to a limit of 79 characters?

I read the section on line length in PEP8 and figured out when to break my lines of code. But I'm not sure if the lines should be evenly distributed when setting parameters. Clarification:

Should I break the line only when it reaches the limit of length, like this ( servidor_os):

servidor_khan = models.BooleanField(blank=True, default=False)
servidor_os = models.ForeignKey(
    EquipamientoOs,
    null=True,
    blank=True,
    related_name='servidores',
    verbose_name='SO del servidor')
cantidad_equipo = models.IntegerField(default=0)

Or do this always to keep it uniform, for example:

servidor_khan = models.BooleanField(
    blank=True,
    default=False)
servidor_os = models.ForeignKey(
    EquipamientoOs,
    null=True,
    blank=True,
    related_name='servidores',
    verbose_name='SO del servidor')
cantidad_equipo = models.IntegerField(
    default=0)
+4
source share
1 answer

Typically, people only break a procedure call on multiple lines if it exceeds the length of the line. Since most calls go to one line, this tends to keep more code on the screen at a time.

, ( ), .

Python . , , , .

0

Source: https://habr.com/ru/post/1693529/


All Articles