Although I think I would start by saying this: where "spam" and "eggs" is used in Python, it is in the place of any other word, usually a nonsense word like "foo" or "bar", and its presence does not distract. I doubt anyone thinks of actual SPAM or actual eggs when they run across it, and I seriously doubt the documentation authors intended or expected anyone to.
The (so-called) joke in this glibc discussion is a) essentially a pun on the name of the function, i.e., introducing mental confusion; b) a political subject; c) an ill-explained reference to a political subject (did you know it's about the global gag rule? do you know what the global gag rule is?); d) intended to make you think about that subject instead of tuning it out.
Python's use of "spam" and "eggs" adds some character, that's about it. (Python's insistence on "eggs" and "wheels" and "cheeseshop", on the other hand... I find the names cute but if you wanted to get rid of them all in favor of slightly more descriptive words, I'd honestly be in favor.) This joke serves no purpose other than, at best, to distract the attention of the person looking up documentation onto a completely different subject.
They haven't always been that way. The Python docs back around 2000 were not that great. A lot of work has been put in by people in the community to get them to the state they're in.
Just last friday I tried to find authoritative definition of the leading underscore mangling behavior in the docs and was not able to do so.
In any case that question seems wildly unrelated to the question at hand, which is about a joke that's intended to be a present-day political reference.