Why Nostr? What is Njump?
2024-05-10 15:36:13

myrmepropagandist on Nostr: I have a list of 3 python objects w/ 4 attributes. If exactly 2 are identical (not ...

I have a list of 3 python objects w/ 4 attributes. If exactly 2 are identical (not all 3, not none) I want to return False.

mylist=[ob1, obj2, obj3]

if len(set([x.attribute1 for x in mylist]))==2:
return False
if len(set([x.attribute2 for x in mylist]))==2:
return False
if len(set([x.attribute3 for x in mylist]))==2:
return False
if len(set([x.attribute4 for x in mylist]))==2:
return False
return True

feels clunky. what am i missing?

(can you guess what card game?)
Author Public Key
npub1cp2pgntkzkpqa23rytnchggwzywyggvst9yzkgd6w8j349ef7s9shuhrnq