What's the proper style for a library string function?
rosuav at gmail.com
Sun Jul 20 02:41:56 CEST 2014
On Sun, Jul 20, 2014 at 4:40 AM, Wojciech Giel <wojtekgiel at 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.
More information about the Python-list