[Python-ideas] Programming recommendations (PEP 8) and boolean values

Nick Coghlan ncoghlan at gmail.com
Thu Aug 9 03:27:34 CEST 2012

On Thu, Aug 9, 2012 at 8:39 AM, Lefavor, Matthew
(GSFC-582.0)[MICROTEL LLC] <matthew.lefavor at nasa.gov> wrote:
> I don't think PEP 8 is meant to cover a specialized cases like testing.
> Keep in mind the recommendation in the beginning of the style guide: "But
> most importantly: know when to be inconsistent -- sometimes the style
> guide just doesn't apply."

Right, there are broad swathes of programming guidelines that simply
*don't apply* when writing tests. In order to properly isolate the
behaviours you want to test, you often end up doing things that would
be legitimately considered downright evil if you ever did them in
production code.

The recommendations in PEP 8 are for production code that is meant to
*do things*. Test code, which is checking whether or not *other* code
is doing the expected things, isn't typical production code.


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-ideas mailing list