Actually use 4-space indents in the PEP too.
This commit is contained in:
parent
4599356ec7
commit
8def3e9cac
20
pep-0007.txt
20
pep-0007.txt
|
@ -63,12 +63,12 @@ Code lay-out
|
|||
static int
|
||||
extra_ivars(PyTypeObject *type, PyTypeObject *base)
|
||||
{
|
||||
int t_size = PyType_BASICSIZE(type);
|
||||
int b_size = PyType_BASICSIZE(base);
|
||||
int t_size = PyType_BASICSIZE(type);
|
||||
int b_size = PyType_BASICSIZE(base);
|
||||
|
||||
assert(t_size >= b_size); /* type smaller than base! */
|
||||
...
|
||||
return 1;
|
||||
assert(t_size >= b_size); /* type smaller than base! */
|
||||
...
|
||||
return 1;
|
||||
}
|
||||
|
||||
- Code structure: one space between keywords like 'if', 'for' and
|
||||
|
@ -76,10 +76,10 @@ Code lay-out
|
|||
shown:
|
||||
|
||||
if (mro != NULL) {
|
||||
...
|
||||
...
|
||||
}
|
||||
else {
|
||||
...
|
||||
...
|
||||
}
|
||||
|
||||
- The return statement should *not* get redundant parentheses:
|
||||
|
@ -100,8 +100,8 @@ Code lay-out
|
|||
appropriately, e.g.:
|
||||
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"cannot create '%.100s' instances",
|
||||
type->tp_name);
|
||||
"cannot create '%.100s' instances",
|
||||
type->tp_name);
|
||||
|
||||
- When you break a long expression at a binary operator, the
|
||||
operator goes at the end of the previous line, e.g.:
|
||||
|
@ -109,7 +109,7 @@ Code lay-out
|
|||
if (type->tp_dictoffset != 0 && base->tp_dictoffset == 0 &&
|
||||
type->tp_dictoffset == b_size &&
|
||||
(size_t)t_size == b_size + sizeof(PyObject *))
|
||||
return 0; /* "Forgive" adding a __dict__ only */
|
||||
return 0; /* "Forgive" adding a __dict__ only */
|
||||
|
||||
- Put blank lines around functions, structure definitions, and
|
||||
major sections inside functions.
|
||||
|
|
Loading…
Reference in New Issue