summaryrefslogtreecommitdiff
path: root/CODING
diff options
context:
space:
mode:
authorKai Huuhko <kai.huuhko@gmail.com>2013-03-30 22:22:33 +0000
committerKai Huuhko <kai.huuhko@gmail.com>2013-03-30 22:22:33 +0000
commit70e0ef0be8b86c66b447d5929c1b673f78e84be5 (patch)
tree8418e281770dde8366f92dc21dea0665aff9f3c0 /CODING
parent28d68cf2a026d08c82eb7b85add2479da1acafc3 (diff)
Add discussion items to CODING.
Diffstat (limited to 'CODING')
-rw-r--r--CODING46
1 files changed, 41 insertions, 5 deletions
diff --git a/CODING b/CODING
index bcf1b41..be09977 100644
--- a/CODING
+++ b/CODING
@@ -5,11 +5,7 @@ Style
5* For indentation, use *four space characters* per level of indentation. 5* For indentation, use *four space characters* per level of indentation.
6 6
7* When comparing C pointers, use == and != instead of the python operator "is". 7* When comparing C pointers, use == and != instead of the python operator "is".
8 This makes a visual distinction between C and py code and don't confuse the 8 This makes a visual distinction.
9 reader as "==" and "is" has different meaning in python.
10
11* Internal utility functions used in the bindings must start with an
12 underscore and must have the shortest name as possible.
13 9
14Design patterns 10Design patterns
15=============== 11===============
@@ -47,3 +43,43 @@ Ideas
47===== 43=====
48 44
49* Use a decorator for _METHOD_DEPRECATED 45* Use a decorator for _METHOD_DEPRECATED
46
47Discussion
48==========
49
50* When comparing C pointers, use == and != instead of the python operator "is".
51 This makes a visual distinction between C and py code and don't confuse the
52 reader as "==" and "is" has different meaning in python.
53 ^
54 This last clarification is not true. We're actually comparing whether two
55 references are the same (pointer comparison) which is what the operator
56 "is" does in Python, not whether their value is the same, which is what
57 "==" does in Python.
58
59 This is a direct quote from Cython developer Stefan Behnel:
60 "If a user wants pointer comparison, "is" is the most explicit operator
61 w.r.t. Python semantics."
62
63 I don't mind if it's "==" for visual difference, but confusing everyone
64 by first telling them the operators' meaning in Python and then using them
65 in reverse is absolutely not acceptable.
66
67 / kuuko
68
69* Internal utility functions used in the bindings must start with an
70 underscore and must have the shortest name as possible.
71 ^
72 This needs further discussion/expansion.
73
74 When we define a function with cdef it is not exposed to Python API.
75 This should be explicit enough to not need the underscore prefix, which
76 at best looks ugly, and at worst just plain confusing.
77
78 A function name should summarize its functionality in one clear text,
79 short sentence. We have both too long and too short names. And I admit to
80 being guilty of adding many of both.
81
82 Let's build up a short review so we can see where we stand with this and
83 make necessary corrections.
84
85 / kuuko