On a number of occasions, I've come across questions and which have nothing to do with gender, but contain example code assuming binary gender. A question might ask
What's the pythonic way to designate unreachable code in python as in:
gender = readFromDB(...) # either 'm' or 'f'
if gender == 'm':
greeting = 'Mr.'
elif gender == 'f':
greeting = 'Ms.'
else:
# how to indicate this can't happen?
when something like this would be equally illustrative, but be uncontroversial:
accessLevel = readFromDB(...) # should be ENUM('USER', 'ADMIN')
if accessLevel == 'ADMIN':
showDebugInfo = True
elif accessLevel == 'USER':
showDebugInfo = False
else:
# how to indicate this can't happen?
Why not make this change?
In the context of the question, this change has no bearing on the meaning. It reads from a database, it has an if/elif/else chain based on the result (which is supposed to be an enum), some code runs based on the values, the else branch should never be taken.
Bringing up gender when it's not relevant, and especially claiming in example code that it can only be one of two possible values, is "likely to offend". Identity documents with three or more gender options are widely accepted and available.
Per the code of conduct:
language likely to offend or alienate people based on race, gender, sexual orientation, or religion
Many such examples literally assert
that some people's genders do not exist.
I've seen previous discussions about editing old content, for example the campaign to rid Stack Overflow of bad cryptography code.
The general consensus is that if you can "fix" the answer without destroying it, do so.
If you don't see a problem with the use of gender as an example for a question that is not about gender, consider the following example in the context of a question such as "how can I ensure the value of a variable is one from a small list":
(I'm sorry that this is provocative, but it wouldn't illustrate the point otherwise)
if race not in ('white', 'black'):
raise ValueError(f'invalid value for race: `{race}`')
The "answers" provided here don't really answer this question, and the closest thing to a duplicate cited here is one where the conclusion was that editing to remove a dig at hipsters is fine.
Cited duplicates:
- Are moderators allowed to tolerate Islamophobic posts?
A moderator who has been active on this question said would have been appropriate to edit, but the reference has been deleted entirely. This seems inconsistent with the response here.
- Is editing code in posts to remove gender frowned upon?
This question is about whether using "dude" as a variable name is a thing that should be fixed.
- Edit a post that can (possibly) contain offensive/unnecesary text
The hipster question, people seemed to think it was okay or not care.
- What makes something offensive?
Question lack context, answer cites a page that no longer exists.