18+ futurebird,
@futurebird@sauropods.win avatar

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?)

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • khanakhh
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • osvaldo12
  • ethstaker
  • Youngstown
  • mdbf
  • slotface
  • rosin
  • everett
  • ngwrru68w68
  • kavyap
  • InstantRegret
  • megavids
  • GTA5RPClips
  • Durango
  • normalnudes
  • cubers
  • tacticalgear
  • cisconetworking
  • tester
  • modclub
  • provamag3
  • anitta
  • Leos
  • JUstTest
  • lostlight
  • All magazines