pythonic styleに関するまとめ(1):PEP8
を読んでいて気になった以下の部分
コメント
文書の句点後にスペースを二つ入れよう
原文は以下。
http://legacy.python.org/dev/peps/pep-0008/
You should use two spaces after a sentence-ending period.
これについての議論は以下。
https://stackoverflow.com/questions/21571994/why-does-pep8-suggest-using-two-spaces-in-comments
その議論において紹介されている
NPE answered Feb 5 '14 at 8:36
I've had a look at the standard library source code, and my conclusion is that this particular aspect of the style guide is not followed consistently: some standard modules follow it and some don't.
順守している例
https://hg.python.org/cpython/file/32af4954e46a/Lib/email/contentmanager.py
の231行目以降。
if cte == 'base64': data = _encode_base64(data, max_line_length=msg.policy.max_line_length) elif cte == 'quoted-printable': # XXX: quoprimime.body_encode won't encode newline characters in data, # so we can't use it. This means max_line_length is ignored. Another # bug to fix later. (Note: encoders.quopri is broken on line ends.) data = binascii.b2a_qp(data, istext=False, header=False, quotetabs=True) data = data.decode('ascii')
Anotherの前に確かに2つの空白があるようだ。
推測であるが、英語などの文書においては単語間の空白が入る。文の区切りを明確にするために、文を2つの空白で区切るという考えのようだ。
日本語コメントでは単語間に空白は入らないので、同じルールを適用する必要性があるかどうか。