logoalt Hacker News

gpderetta • 11/20/2024 • 0 replies • view on HN

Instead of returning an __eq__ object, I have had 'contains' just return a predicate function (that you can pass to filter for example. I guess in practice it doesn't really change much, except that calling it __eq__ is a bit misleading.

A significant advantage is that you can just pass an inline lambda.