Closed azanbinzahid closed 4 years ago
This is by design. The snippet is supposed to by asymmetrical returning matching values in the first group after applying the transformation to both.
Then I guess it should be added to description for celerity.
The
intersection_by
snippet description says:As per given example:
Let's dry run this, as per description given function floor will transform both lists as:
Then we take intersection between transformed list which results in
[2]
and return the elements from original list. Here's the catch if I am not missing anything,2.1
from list 1 and2.3
from list 2 has equal chances of getting in return list but former is returned. Is this behavior by design? This pattern is repeated in otherlist __by
snippets as well.Here are some more examples that this snippet returns: