Actually the bitwise operations is completely applicable to the sets (i.e. the wiki XOR article contains Venn's diagrams). That's happening because of the bitwise operations are applied not to the values but to their presence in the set.
cats={...}animals={...}dogs={...}cat_dog_nickelodeon=cats&dogs# intuitive
other_animals=animals-(cats|dogs)# beautiful
other_animals=animals.difference(cats.union(dogs))# much more ugly
That's happening because of the bitwise operations are applied not to the values but to their presence in the set.
Thanks for reminding me about that. I still prefer the explicit version in "day to day" code though, especially because they can be used dynamically if needed!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Actually the bitwise operations is completely applicable to the sets (i.e. the wiki XOR article contains Venn's diagrams). That's happening because of the bitwise operations are applied not to the values but to their presence in the set.
Thanks for reminding me about that. I still prefer the explicit version in "day to day" code though, especially because they can be used dynamically if needed!