Suor / funcy

A fancy and practical functional tools
BSD 3-Clause "New" or "Revised" License
3.35k stars 142 forks source link

feat: where_not #143

Closed iloveitaly closed 7 months ago

iloveitaly commented 9 months ago

Can add tests + docs if you like the idea!

Suor commented 8 months ago

This kinda confusing that this where_not() will only let through items having none of the conditions satisfied, while I would expect it to be a complement of where(), i.e. letting through items where at least one condition is not satisfied being a complement of where().

Then again somebody would expect your behavior, which makes it a good idea to leave this for list comprehensions maybe.

iloveitaly commented 7 months ago

@Suor I like OR instead of the current AND here: if people want AND, they can chain multiple where_not.

Still think it should be left to list comprehensions, or if I switch the logic here would this make more sense to add?

Suor commented 7 months ago

Chaining is both wordy and inefficient and doesn't solve the core issue of many people understanding it wrong, be it either OR or AND.