Project

General

Profile

CodeStyle » History » Revision 26

Revision 25 (Alex Afanasyev, 04/24/2014 11:11 AM) → Revision 26/30 (Alex Afanasyev, 04/24/2014 11:11 AM)

# NFD code style guidelines 

 ## ndn-cxx code style 

 NFD adopts [ndn-cxx code style](http://named-data.net/doc/ndn-cpp-dev/0.4.0/code-style.html) 

 ## Python addition 

 Most of the provisions in the above style guidance apply to Python as well.    For python-specific elements, [PEP 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](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)