Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #74847

Re: What's the proper style for a library string function?

References <53CAAD27.9010207@cdreimer.com> <53CABB99.8020009@gmail.com>
Date 2014-07-20 10:41 +1000
Subject Re: What's the proper style for a library string function?
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.12072.1405816923.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Sun, Jul 20, 2014 at 4:40 AM, Wojciech Giel <wojtekgiel@gmail.com> wrote:
> You might look into PEP8 "Style Guide for Python Code" it will give you
> recommendation how to write a code. among other gives most sensible answer:
>  "Consistency within a project is more important. Consistency within one
> module or function is most important...... When in doubt, use your best
> judgment. Look at other examples and decide what looks best."

But perhaps the most crucial part of PEP 8 is up in the introductory text:

"""
But most importantly: know when to be inconsistent -- sometimes the
style guide just doesn't apply.
...
Some other good reasons to ignore a particular guideline:

1. When applying the guideline would make the code less readable, even
for someone who is used to reading code that follows this PEP.
"""

This is a very New Testament style of guidebook: your conscience is
very important, the details of the rules are subordinate to the
overriding principle of readability. In Dungeons & Dragons terms,
you're called to be a paladin with an emphasis on Good where it
conflicts with Lawful. This is PEP 8's anti-bureaucracy rule.

ChrisA

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: What's the proper style for a library string function? Chris Angelico <rosuav@gmail.com> - 2014-07-20 10:41 +1000

csiph-web