Project

General

Profile

CodeStyle » History » Revision 29

Revision 28 (Alex Afanasyev, 04/25/2014 09:23 AM) → Revision 29/30 (Davide Pesavento, 05/14/2020 10:56 AM)

# NFD code style guidelines 

 ## C++ code style 

 NFD adopts the [ndn-cxx code style](https://named-data.net/doc/ndn-cxx/current/code-style.html). style](http://named-data.net/doc/ndn-cxx/current/code-style.html) 

 ## Python code style addition 

 Most of the provisions in the above style guidance apply to Python as well.    For python-specific elements, [PEP 8](https://www.python.org/dev/peps/pep-0008/) 8](http://legacy.python.org/dev/peps/pep-0008/) can be used as a reference coding style. 

   

 The following is few rules directly adopted from [PEP 8](https://www.python.org/dev/peps/pep-0008/): 8](http://legacy.python.org/dev/peps/pep-0008/): 

 * **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)