NFD code style guidelines

C++ code style

NFD adopts the ndn-cxx code style.

Python code style

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 Davide Pesavento over 1 year ago · 29 revisions