Three ways to add pronoun method/property to gendered class in Python Say you have a Python class for something that has an optional gender field. You'd like a helper property/method to get the appropriate pronoun for an instance. You'd also like to be able to get the possessive version of the pronoun. The use for these helpers will be in creating human-readable emails and other such messages related to the object.

Below are three ways to do it. Which is best in terms of style and design and why?

Option 1

@property
def pronoun(self):
    return "he" if self.gender == 'male' else "she" if self.gender == 'female' else "they"

@property
def possessive_pronoun(self):
    return "his" if self.gender == 'male' else "her" if self.gender == 'female' else "their"


Option 2

def pronoun(self, possessive=False):
    if possessive:
        return "his" if self.gender == 'male' else "her" if self.gender == 'female' else "their"
    else:
        return "he" if self.gender == 'male' else "she" if self.gender == 'female' else "they"


Option 3

def pronoun(self, possessive=False):
    pronouns = ("he", "his") if self.gender == 'male' else ("she", "her") if self.gender == 'female' \
        else ("they", "their")
    return pronouns[1] if possessive else pronouns[0]


Feel free to suggest an even better fourth option. 

P.S. In case you are wondering, I like to use double quotes for strings meant for human consumption, single quotes otherwise.
I usually try to use data structure over code whenever it's possible.
It usually make things shorter, easier to read and easier to update.

If I had to write such a thing, I'd probably write something like (untested code but just to show the idea) :

pronouns = {
    'male' =&gt; ("he","his"),
    'female' =&gt; ("she", "her")
}

def pronoun(self, possessive=False):
    return pronouns.get(self.gender, default=("they","their"))[possessive]


If we could be sure that self.gender has only 3 different values, the default value could be put in the pronouns dictionnary straightaway (associated to "plural" for instance).

Different variations could be written. I guess one could use defaultdict to ensure that we always retrieve the default value. I don't like this solution that much as the dictionnary would get bigger as we try to retrieve using invalid keys.

I don't know if there's a (simple) way to have a dictionnary which returns a default value when the key is not present without updating the dictionnary but I'd be interested in such a thing.