Changes between Version 29 and Version 30 of CodingStandards


Ignore:
Timestamp:
2014-10-10T15:57:56Z (10 years ago)
Author:
zooko
Comment:

add athing in adict

Legend:

Unmodified
Added
Removed
Modified
  • CodingStandards

    v29 v30  
    4343 * Don't use the literals {{{True}}} or {{{False}}} in conditional expressions -- instead just write the expression which will evaluate to true or false. For example, write {{{if expr:}}} instead of {{{if expr == True:}}} and {{{if not expr:}}} instead of {{{if expr == False:}}}.
    4444 * Avoid relying on the fact that empty sequences, empty strings, empty dicts, {{{0}}}, and {{{None}}} are treated as false. Write {{{if len(items) == 0:}}}, {{{if thing is None:}}}, etc.
     45
     46=== Miscellaneous ===
     47
     48 * {{{athing in adict.keys()}}} can be replaced by {{{athing in adict}}}, which evaluates to the same boolean result, but is more succinct and more efficient at run-time.
    4549
    4650== Idioms ==
     
    165169        self.backendtype = backendtype
    166170}}}
    167 .
    168 
    169171
    170172== Official Python Standards ==