在Scrapy Pipeline中,return super().process_item是什么意思?
In Scrapy Pipeline, return super().process_item means what?
我发现了一个 scrapy pipelines 代码:
class SomeImagePipeline(ImagePipeline):
....
....
def process_item(self, item, spider):
return super(SomeImagesPipeline, self).process_item(item, spider)
“super(SometImes Pipeline, self).process_item(item, spider)”是什么意思??
根据standard documentation on super,超级方法:
Return a proxy object that delegates method calls to a parent or sibling class of type. This is useful for accessing inherited methods that have been overridden in a class.
因此,return super(SomeImagesPipeline, self).process_item(item, spider)
调用基础 class 的 process_item
方法,即 ImagePipeline
和 return 其 return 对象。
我发现了一个 scrapy pipelines 代码:
class SomeImagePipeline(ImagePipeline):
....
....
def process_item(self, item, spider):
return super(SomeImagesPipeline, self).process_item(item, spider)
“super(SometImes Pipeline, self).process_item(item, spider)”是什么意思??
根据standard documentation on super,超级方法:
Return a proxy object that delegates method calls to a parent or sibling class of type. This is useful for accessing inherited methods that have been overridden in a class.
因此,return super(SomeImagesPipeline, self).process_item(item, spider)
调用基础 class 的 process_item
方法,即 ImagePipeline
和 return 其 return 对象。