Document Information
180 Reads | 0 Comments
Description
We have to adopt a style for presenting Python. We won't present a complete set of coding
standards, instead we'll present examples. This section has some justification of the style we
use for the examples in this book.
Just to continune this rant, we find that actual examples speak louder than any of the
gratuitously detailed coding standards which are so popular in IT shops. We find that many
IT organizations waste considerable time trying to write descriptions of a preferred style. A
good example, however, trumps any description. As consultants, we are often asked to
provide standards to an inexperienced team of programmers. The programmers only look at
the examples (often cutting and pasting them). Why spend money on empty verbiage that is
peripheral to the useful example?
One important note: we specifically reject using complex prefixes for variable names.
Prefixes are little more than visual clutter. In many places, for example, an integer parameter
with the amount of a bet might be called pi_amount where the prefix indicates the scope (p
for a parameter) and type (i for an integer). We reject the pi_ as useless and uninformative.
This style of name is only appropriate for primitive types, and doesn't address complex data
458 Pages