C0326

Message

%s space %s %s %s\n%s

Exactly one space required before assignment
Exactly one space required after comparison
No space allowed before comma
Exactly one space required after comma
No space allowed before bracket
No space allowed after bracket
No space allowed before :

Description

Used when a wrong number of spaces is used around an operator, bracket, or comma, or before a block opener colon.

This message belongs to the format checker.

In PyLint 1.1.0, this message replaced the older whitespace-related messages C0322, C0323, and C0324, and now reports some additional situations.

Explanation

This message is raised when any of the following rules is violated:

  • Any of the following operators is surrounded by one space: ==, !=, <>, <=, >=, <, >, =, +=, -=, *=, **=, /=, //=, &=, |=, ^=, %=, >>=, <<=
  • Any opening bracket ( (, [, { ) is not followed by any space.
  • Any closing bracket ( ), ], } ) is not preceded by any space.
  • Any comma is not preceded by any space, and is followed by one space.
  • Any block opener colon is not preceded by any space (spaces that follow are raised by C0303 or C0321).

Following these rules improves consistency across different developers and in addition leads to better readability, and thus makes for easier debugging.

See also PEP 8: Whitespace in Expressions and Statements


Add a New Comment
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License