Skip to content

How does "Knuth's style" for line breaks translate to code? #186

Closed

Description

@gsganden

PEP 8 says the following:

In Python code, it is permissible to break before or after a binary operator, as long as the convention is consistent locally. For new code Knuth's style is suggested.

However, I don't see how Knuth's style applies to code. Knuth's style distinguishes between formulas within paragraphs and displayed formulas. What is the analogous distinction in a coding context?

Activity

  1. gvanrossum commented on Jan 19, 2017

    @gvanrossum
    Member

    In this context, "Knuth's style" refers to the immediately preceding example, i.e. break before binary operators. We should consider Python code always to be equivalent to "displayed formulas".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions