悪いコーディングスタイルの例
コーディングスタイルの常識をぶち壊せ (1/2):CodeZine(コードジン) 。これはひどい。例B もどうかとおもうが、例C は改悪だろ。
コメント見ると同士発見。
>ここまでキレイにそろうと、代入部分「= 10;」とかも揃えたくなるものです。
視認性が下がってるよ。
Python のコーディングスタイルガイド PEP8 にもこうある。
Whitespace in Expressions and Statements Pet Peeves Avoid extraneous whitespace in the following situations: - More than one space around an assignment (or other) operator to align it with another. Yes: x = 1 y = 2 long_variable = 3 No: x = 1 y = 2 long_variable = 3
まぁ冒頭には
But most importantly: know when to be inconsistent -- sometimes the style
guide just doesn't apply.
とあり、柔軟な考え方をするよう心がけること、決まりの破り方のほうが大事といったことが書かれているが。
著者が一番いいたかったこともこういうことだとは思うんだけど、いかんせん例が悪かった。