Project

General

Profile

CodeStyle » History » Version 25

Alex Afanasyev, 04/24/2014 11:11 AM

1 1 Junxiao Shi
# NFD code style guidelines
2
3 25 Alex Afanasyev
NFD adopts [ndn-cxx code style](http://named-data.net/doc/ndn-cpp-dev/0.4.0/code-style.html)
4 19 Alex Afanasyev
5
## Python addition
6
7
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.  
8
9 1 Junxiao Shi
The following is few rules directly adopted from [PEP 8](http://legacy.python.org/dev/peps/pep-0008/):
10
11
* **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).
12
13
        def complex(real, imag=0.0):
14
            value = 1.1
15
            return magic(r=real + value, i=imag)
16
17
* **P2** Don't use spaces around the = sign when used to indicate a keyword argument or a default parameter value.
18
19
        def complex(real, imag=0.0):
20
            return magic(r=real, i=imag)