I'm using a list comprehension to find an object that matches in two lists and return the object for its property. I know the object ALWAYS exists in both lists and no other item in the lists are shared but I don't know which one it is so I can't just reference it from the list.
The code I can give you is:
class BaseballCard: ... @staticmethod def load_from_matching_player_with_other_org(organization, other_org): """Determine matching pair of the same player and create Baseball Card.""" return BaseballCard(*[player for player in organization.players if player in other_org].stats) ...
Is there a better or simpler way to do this part?
[player for player in organization.players if player in other_org]
Topic slightly changed to protect sensitive data