Skip to content

Instantly share code, notes, and snippets.

@crazygit
Last active March 13, 2023 15:33
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save crazygit/7bdd38ed60ff062f0693b94145710576 to your computer and use it in GitHub Desktop.
Save crazygit/7bdd38ed60ff062f0693b94145710576 to your computer and use it in GitHub Desktop.
The difference of scrapy built in loader processor Compose and MapComose
from scrapy.loader.processors import Compose, MapCompose
proc = Compose(lambda v: v[0], str.upper)
proc(['hello', 'world']) # HELLO
mproc = MapCompose(lambda v: v[0], str.upper)
mproc(['hello', 'world']) # ['H', 'W']
@blorgblerg
Copy link

This says more than a thousand words.

@zzossig
Copy link

zzossig commented Aug 12, 2019

good example

@ivandvpr
Copy link

Better than in official documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment