Python if语句"SyntaxError:invalid syntax"

ped*_*uiz 0 python syntax-error

试图执行某人的代码,得到语法错误.不知道为什么:(

def GetParsers( self, systags ):
    childparsers = reduce( lambda a,b : a+b, [[]] + [ plugin.GetParsers( systags ) for plugin in self.plugins ] )
    parsers = [ p for plist in [ self.parsers[t] for t in systags if self.parsers.has_key(t) ] for p in plist ]
    return reduce( lambda a,b : ( a+[b] if not b in a else a ), [[]] + parsers + childparsers )
Run Code Online (Sandbox Code Playgroud)

错误是

File "base.py", line 100
    return reduce( lambda a,b : ( a+[b] if not b in a else a ), [[]] + parsers + childparsers )
Run Code Online (Sandbox Code Playgroud)

Python版本

Python 2.2.3 (#1, May  1 2006, 12:33:49)
[GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-54)] on linux2

                                         ^                                             
Run Code Online (Sandbox Code Playgroud)

小智 5

2.5 (源)中添加了条件表达式- 你有2.2.所以,我担心你没有条件表达.它们在该版本中尚不存在.如果可以的话,明确地更新(不仅仅是为了这个小小的变化,自06年以来就有成千上万的变化).