TypeError: can only concatenate list (not "filter") to list

TypeError: can only concatenate list (not "filter") to list

我该如何解决这个错误?

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-10-4e1a4ac4ce1b> in <module>()
----> 1 j = NJoin(R, S)
      2 render_markdown(j)
      3 print(get_result(j))

/Users/mona/CS460_660/relation_algebra.py in __init__(self, op1, op2)
    164         self.common = s1.intersection(s2)
    165         self.op_str = "$\Join_{{{0}}}$".format(','.join(self.common))
--> 166         OpBase.__init__(self, op1.schema + filter(lambda x : x not in self.common, op2.schema), [op1,op2])
    167         self.count_reads = True
    168 

TypeError: can only concatenate list (not "filter") to list

这是整个 relation_algebra.py 文件: https://pastebin.com/Nwuddb77

我使用 conda create 创建了一个 py27 虚拟环境,因为作者建议使用 Python2.7 而不是 Python3.6,如 https://github.com/HazyResearch/cs145-notebooks-2016/tree/master/lecture-16 当我从 jupyter notebook 执行此单元格时,出现上述错误: 在那之前我在其他单元格中没有其他错误

当我 运行 使用 Python 3.6 的代码时,我也遇到了同样的错误: https://github.com/HazyResearch/cs145-notebooks-2016/issues/4

确认更改以下行:

OpBase.__init__(self, op1.schema + filter(lambda x : x not in self.common, op2.schema), [op1,op2])

至:

OpBase.__init__(self, op1.schema + list(filter(lambda x : x not in self.common, op2.schema)), [op1,op2])

已解决问题。