From 930ca56dfc89f37d3f181ce7a42002019128281d Mon Sep 17 00:00:00 2001 From: jomo Date: Wed, 16 Jul 2014 00:59:02 +0200 Subject: [PATCH] add readability to coding guidelines --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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