diff options
author | jomo <github@jomo.tv> | 2014-07-16 00:59:02 +0200 |
---|---|---|
committer | jomo <github@jomo.tv> | 2014-07-16 00:59:02 +0200 |
commit | 930ca56dfc89f37d3f181ce7a42002019128281d (patch) | |
tree | bbad9f80d6aa91673973928987127b9b0977e9e5 /README.md | |
parent | 9a0779d16840b90f7166fbdd8c29c26d06d79c6e (diff) |
add readability to coding guidelines
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -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 |