Mercurial > hg > Members > shinya > pyrect
changeset 58:81337db23999
modify ternary operator (ex: return s1 if ~~ else s2). for python2.4 ;-(
author | Ryoma SHINYA <shinya@firefly.cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 01 Nov 2010 14:50:52 +0900 |
parents | 81b44ae1cd73 |
children | fd3d0b8326fe |
files | pyrect/translator/grep_translator.py |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/pyrect/translator/grep_translator.py Mon Nov 01 14:41:03 2010 +0900 +++ b/pyrect/translator/grep_translator.py Mon Nov 01 14:50:52 2010 +0900 @@ -60,7 +60,11 @@ def emit_filter(self, words): def longest(s1, s2): - return s1 if len(s1) >= len(s2) else s2 + if len(s1) >= len(s2): + return s1 + else: + return s2 + key = reduce(longest, words) if len(words) == 1: