-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add n argument to TakeFirst processor #38
Comments
It lets the return type depend on an argument, TakeFirst(None)(List) would return just an element of the list while TakeFirst(1)(List) an element of the list wrapped in a list.
On the one hand TakeFirst(3) looks like natural language but on the other it implies a different return type. I would rather see a function, like an argument to filter, passed to TakeFirst() allowing for customization of the default "value is not None and value != '' " (I am just saying this here/now because it conflicts with the above proposal) |
From my perspective, the loader.processor lacks two loaders. I 'd go a bit further, since your TakeFirst(-1) made me think of: Now "Slice": Most processors offer practical shortcuts for long compositions of lambdas, "functools" and "operator". I see TakeFirst as a shortcut of shorcuts. To say this in plain code Digenis/scrapy@1f088d4 |
(just digging out old issues) |
TakeFirstN sounds fine to me, though I haven't used item loaders for a long time. |
What do you think about adding "n" argument to TakeFirst processor?
TakeFirst(3)
would mean "return a list with at most 3 non-empty values".The text was updated successfully, but these errors were encountered: