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


Groups > comp.lang.python > #74847 > unrolled thread

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

Started byChris Angelico <rosuav@gmail.com>
First post2014-07-20 10:41 +1000
Last post2014-07-20 10:41 +1000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

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

FromChris Angelico <rosuav@gmail.com>
Date2014-07-20 10:41 +1000
SubjectRe: What's the proper style for a library string function?
Message-ID<mailman.12072.1405816923.18130.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web