confirming dict def behavior with gender diversity dict
I was playing with this somewhat dated and not fully accepted key or legend the gender diversity people sometimes use: . diversity_acronyms = {'G':'Gay', 'L':'Lesbian', 'T':'Trans', 'B':'Bi', 'Q':'Queer', 'Q':'Questioning', 'H':'Hetero', 'I':'Intersex', 'P':'Pan' } . diversity_acronyms.keys() dict_keys(['Q', 'P', 'B', 'T', 'G', 'I', 'H', 'L']) . diversity_acronyms['Q'] 'Questioning' Yes, given it's a mapping we all know that there's no special ordering of the keys or the items in general i.e. QPBTGIHL is but one permutation. But my question is regarding key unique-ness: (we lost a Q) and the rules of precedence at define time. Do we always lose the *same* Q? i.e. in defining the dict top to bottom (above and again below), I mention a 2nd 'Q' after a first, so I'm confirming it would always be the last of any given key that survives to be in the dict final dict. Testing: . diversity_acronyms = {'G':'Gay', 'L':'Lesbian', 'T':'Trans', 'B':'Bi', 'Q':'Questioning', 'Q':'Queer', 'H':'Hetero', 'I':'Intersex', 'P':'Pan' } . diversity_acronyms['Q'] 'Queer' Right, I'm guessing this is in the docs somewhere. I think I've answered my own question. My question for diversity-sig would be: do folks here think there'd be strong objections to replacing 'Q' for 'Queer' with 'P' for 'Pan' which is a relatively new one, meant more as a rounding-out catch-all I think? But that's what 'Queer' used to mean originally: "anything broader minded than boring straight" (rough translation). Queer was the parent class with any narrowing to G, L, H, B considered subclasses of a more generic API. Given a dict needs a unique key per value, the goal in replacing 'Queer' with 'Pan' as the base class (and dict key) in some implementations, is to more conform to Pythonic semantics (unique key requirements) while preserving the gender diversity spectrum already in the cards (this acronym is not my invention, is well-known in GLTBQ literature). But this is edu-sig not diversity-sig and I'm mainly just confirming that the order in which keys in a dict are defined determines, in a deterministic / predictable manner, which value survives. Kirby
participants (1)
-
kirby urner