我有一个名为 MyFilter
. 在其中一个方法中,我过滤了一个列表。
def __gatherCommits(self, head, count=2, commits=[]):
next_commits = self.repo.iter_commits(head, max_count=count)
filtered_commits = list(filter(lambda x: x.committed_date == self.current_day, next_commits))
最后一行引起了一个错误。
File "MyFilter.py", line 22, in __gatherCommits
filtered_commits = list(filter(lambda x: x.committed_date == self.current_day, next_commits))
TypeError: 'MyFilter' object is not callable
当我删除这一行时,它就会像预期的那样运行。
正是这样。谢谢大家。我是通过实例化一个类的实例来测试这个类的,这个类的变量是 filter
...:面部掌心。