logoalt Hacker News

abdullahkhalids11/20/20242 repliesview on HN

I don't understand why numeric filters are included. The library is written in python, so shouldn't a lambda function based filter be roughly as fast but much easier/clearer to write.


Replies

MathMonkeyMan11/20/2024

I'm not the author, but this implementation has the benefit of being a JSON compatible DSL that you can serialize. Maybe that's intentional, maybe not.

It does look like Python's comprehensions would be a better choice if you're writing them by hand anyway.

show 2 replies
yunohn11/20/2024

AFAICT this should filter in one pass, so it would be faster than multiple lambdas, or this plus a lambda for numeric.

show 1 reply