Project

General

Profile

Actions

CodeStyle » History » Revision 26

« Previous | Revision 26/30 (diff) | Next »
Alex Afanasyev, 04/24/2014 11:11 AM


NFD code style guidelines

ndn-cxx code style

NFD adopts ndn-cxx code style

Python addition

Most of the provisions in the above style guidance apply to Python as well. For python-specific elements, PEP 8 can be used as a reference coding style.

The following is few rules directly adopted from PEP 8:

  • P1 Always surround these binary operators with a single space on either side: assignment (=), augmented assignment (+=, -= etc.), comparisons (==, <, >, !=, <>, <=, >=, in, not in, is, is not), Booleans (and, or, not).

    def complex(real, imag=0.0):
        value = 1.1
        return magic(r=real + value, i=imag)
    
  • P2 Don't use spaces around the = sign when used to indicate a keyword argument or a default parameter value.

    def complex(real, imag=0.0):
        return magic(r=real, i=imag)
    

Updated by Alex Afanasyev over 10 years ago · 28 revisions