summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorjomo <github@jomo.tv>2014-07-16 00:59:02 +0200
committerjomo <github@jomo.tv>2014-07-16 00:59:02 +0200
commit930ca56dfc89f37d3f181ce7a42002019128281d (patch)
treebbad9f80d6aa91673973928987127b9b0977e9e5 /README.md
parent9a0779d16840b90f7166fbdd8c29c26d06d79c6e (diff)
add readability to coding guidelines
Diffstat (limited to 'README.md')
-rw-r--r--README.md14
1 files changed, 14 insertions, 0 deletions
diff --git a/README.md b/README.md
index ffe7f11..2ef70db 100644
--- a/README.md
+++ b/README.md
@@ -181,6 +181,20 @@ Leave two empty lines before function definitions. In case you need to use `@hoo
## Meaningful names
Give function and variable names meaningful names. If you want to shorten long names, that's fine, but leave a comment on assigment with the actual meaning.
+## Readability
+Don't create long lines with lots of function calls. Split into multiple lines instead.
+
+```Python
+# bad
+foo = int(player_data[str(server.getPlayer(args[4]).getUniqueId())]["details"].["last_login"].strftime("%s"))
+
+# good
+player = server.getPlayer(args[4])
+player_id = str(player.getUniqueId())
+logintime = player_data[played_id]["last_login"]
+epoch_time = int(logintime.strftime("%s"))
+```
+
## Comments
Comments are good!
Please comment everything that's non-obious or makes it easier to understand