diff options
author | davemds <dave@gurumeditation.it> | 2013-03-31 21:16:50 +0200 |
---|---|---|
committer | davemds <dave@gurumeditation.it> | 2013-03-31 21:16:50 +0200 |
commit | 99941b9e7bec7f9e37a98a124cd0cc1ad6fe6aeb (patch) | |
tree | 6235cf32fd4ccd2e300e9f8f8afa1790d4a74a13 /CODING | |
parent | 5043aa38f00d697c0cdf7baf449ff2ffd6f9e5cc (diff) |
Pythn-EFL: try to improve the CODING file
Diffstat (limited to 'CODING')
-rw-r--r-- | CODING | 37 |
1 files changed, 15 insertions, 22 deletions
@@ -2,13 +2,16 @@ | |||
2 | Style | 2 | Style |
3 | ===== | 3 | ===== |
4 | 4 | ||
5 | * For indentation, use *four space characters* per level of indentation. | 5 | * For indentation, use *four space characters* per level of indentation. Keep |
6 | lines under the 80 chars limit (only exception are the functions definition) | ||
7 | |||
8 | * When comparing C pointers with NULL, use == and != instead of the python | ||
9 | operator "is". This makes a visual distinction between python and C code. | ||
6 | 10 | ||
7 | * When comparing C pointers, use == and != instead of the python operator "is". | ||
8 | This makes a visual distinction. | ||
9 | 11 | ||
10 | Design patterns | 12 | Design patterns |
11 | =============== | 13 | =============== |
14 | |||
12 | * From "The Zen of Python": | 15 | * From "The Zen of Python": |
13 | 16 | ||
14 | Beautiful is better than ugly. | 17 | Beautiful is better than ugly. |
@@ -31,6 +34,7 @@ Design patterns | |||
31 | If the implementation is easy to explain, it may be a good idea. | 34 | If the implementation is easy to explain, it may be a good idea. |
32 | Namespaces are one honking great idea -- let's do more of those! | 35 | Namespaces are one honking great idea -- let's do more of those! |
33 | 36 | ||
37 | |||
34 | Tips | 38 | Tips |
35 | ==== | 39 | ==== |
36 | 40 | ||
@@ -39,33 +43,16 @@ Tips | |||
39 | 43 | ||
40 | * cython does automatic dict <-> struct conversion with basic struct members | 44 | * cython does automatic dict <-> struct conversion with basic struct members |
41 | 45 | ||
46 | |||
42 | Ideas | 47 | Ideas |
43 | ===== | 48 | ===== |
44 | 49 | ||
45 | * Use a decorator for _METHOD_DEPRECATED | 50 | * Use a decorator for _METHOD_DEPRECATED |
46 | 51 | ||
52 | |||
47 | Discussion | 53 | Discussion |
48 | ========== | 54 | ========== |
49 | 55 | ||
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 | 56 | * Internal utility functions used in the bindings must start with an |
70 | underscore and must have the shortest name as possible. | 57 | underscore and must have the shortest name as possible. |
71 | ^ | 58 | ^ |
@@ -83,3 +70,9 @@ Discussion | |||
83 | make necessary corrections. | 70 | make necessary corrections. |
84 | 71 | ||
85 | / kuuko | 72 | / kuuko |
73 | |||
74 | |||
75 | The underscore usage is a coding standard in all the EFL, we should try | ||
76 | to follow the efl style also here (where is possible and make sense) | ||
77 | |||
78 | / davemds | ||