Continuing indentation

Ben Finney ben+python at benfinney.id.au
Fri Mar 4 21:22:01 EST 2016


sohcahtoa82 at gmail.com writes:

> Arguing whether or not a style guide is "incorrect" is as silly as
> arguing over whether lima beans are delicious. I think they're
> disgusting, but you can't make a statement of fact about the topic.

Yet there *are* many relevant facts that bear on the choice of one style
over another.

Objective facts about human capacity to comprehend program text.
Objective facts about the intended semantics of a syntactic structure.
Objective facts about how commonly one style is used in deployed code.

Many objective facts exist that are relevant to the choices in a style
guide. Those facts may be infeasible to *measure* with our limited
access to code bases, and limited resources available for such research.
That doesn't take away from the objective nature of what is actually
factual for a criterion.

So it isn't a pure matter of taste and preference, as some assert.

Yet, when facts are too difficult to ascertain, or when in fact several
styles are equally “good” by whatever objective criteria we might choose
— then deciding that specific matter based on some person's preference
can be quite reasonable, in pursuit of *some* single style which will
allow consistency across a code base.

> Style guides are just guides. They're a suggestion. You can agree with
> them or disagree with them.

Right. The power of such a guide comes from whether, and how, it is
enforced within a particular community.

Don't make the mistake of thinking there are *no* relevant objective
facts to discuss, though.

> I just can't understand why so many people get their panties all up in
> a bunch over how other people choose to format their code.

One factor is that we know (objectively!) that there are many relevant
objective facts to be known; paired with a paucity of actual verifiable
research into those facts available for us to apply to these discussions.

People's personal prejudices start to weigh heavily in those
circumstances.

Yet we can neither say “just do whatever you like” (because too much
inconsistency is a huge cost that is what leads us to write style guides
in the first place), nor can we say “it's all subjective, pick one and
stop arguing” (because that's just not true, there are plenty of
relevant facts that bear on the matter of choosing a style).


What we do need is the wisdom to recognise – when several styles have
good arguments supporting them and no objective facts can help decide
between them – *at what point* should we stop arguing that specific
issue, and just pick a style and stick with it.

Choosing too soon risks dismissing relevant facts that can demonstrate
one style is substantially better than the chosen style.

Choosing too late can allow a community to become weary of ever
discussing style issues again, or of arguing past the point of reason,
or of subverting cohesion by violating the style guide, or resenting it.

All of which loses the unified approach which was the whole point of
working on a style guide in the first place. Wisdom is needed to avoid
that.

I don't have a good general answer.

-- 
 \      “Faith is generally nothing more than the permission religious |
  `\     people give to one another to believe things strongly without |
_o__)      evidence.” —Sam Harris, _Letter to a Christian Nation_ 2006 |
Ben Finney




More information about the Python-list mailing list