2

The following is from PEP 8, the official style guide for the Python programming language:

An inline comment is a comment on the same line as a statement. Inline comments should be separated by at least two spaces from the statement.

Isn't it that it sounds wrong and we should swap "by" and "from" parts?

Inline comments should be separated from the statement by at least two spaces.

2
  • 1
    No, it sounds fine the way it is. It's just a stylistic choice.
    – stangdon
    Commented Aug 4, 2022 at 14:34
  • While the two variations are grammatically (& Idiomatically) correct, the second one is a little more logical. Consider this variation : "[[what]] The statement & the Inline comments should be separated [[how]] by at least two spaces." In the first one, the [[what]] is mixed up with the [[how]] , while in the second one (& in my variation) the [[what]] is complete before the [[how]] is given. Like @stangdon says, this is a Stylistic Choice , given the flexibility in English , which user Rounin has listed. [[ +1 to both Question & Answer ]]
    – Prem
    Commented Aug 4, 2022 at 18:57

1 Answer 1

2

In this context, the words

by at least two spaces

represent an explicit qualifier describing how the inline comments should be separated from the statement.

Written English is flexible with regard to where we include this qualifier:

  • Inline comments should be separated from the statement, by at least two spaces.
  • Inline comments should be separated (by at least two spaces) from the statement.
  • Inline comments should be separated - by at least two spaces - from the statement.
  • Inline comments should be separated from the statement - by at least two spaces .
  • Inline comments should be separated by at least two spaces from the statement.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .