changeset 187:e8d0484581ff

created
author 127.0.0.1
date Mon, 03 Feb 2014 12:50:29 +0100
parents 7841990c01d9
children 26d352c7cb48
files if
diffstat 1 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/if	Mon Feb 03 12:50:29 2014 +0100
@@ -0,0 +1,17 @@
+**Wrong:**
+{{{#!python
+return answer and "yes" or "no"
+return ("yes", "no")[answer]
+}}}
+
+**Better:**
+{{{#!python
+return "yes" if answer else "no"
+}}}
+
+**Best:**
+{{{#!python
+if answer:
+    return "yes"
+return "no"
+}}}
\ No newline at end of file