Changes between Version 30 and Version 31 of DevGuide


Ignore:
Timestamp:
Sep 11, 2017, 3:17:54 AM (7 years ago)
Author:
Ryan J Ollos
Comment:

Yoda is not widely used in Python.

Legend:

Unmodified
Added
Removed
Modified
  • DevGuide

    v30 v31  
    7171
    7272Authors are encouraged to conform to the [trac:TracDev/CodingStyle Trac Style Guide] and [http://legacy.python.org/dev/peps/pep-0008/ PEP-0008 style guide].
    73 
    74 There are numerous other recommendations, and while some are mainly a matter of personal aesthetics and preference, others are suggested for review and adoption:
    75  * [wikipedia:Yoda_conditions Yoda conditions] (see [comment:ticket:11622:24]):
    76   * makes comparisons more obvious by putting the constant up-front
    77   * erroneous assignment ('=' instead of '==') can't slip through unnoticed
    78  Example of common style:
    79  {{{
    80 not req.authname or req.authname == 'anonymous'
    81 }}}
    82  The same example in 'Yoda condition' style:
    83  {{{
    84 not req.authname or 'anonymous' == req.authname
    85 }}}
    8673
    8774== Assert Minimum Trac Version Requirement