Side-rant:
I rarely write Python code. One reason for that is the lack of type safety.
Whenever I’m automating something and try to use some 3rd party Python library, it feels like there’s a good 50/50 chance that front and center in its API is some method that takes a dict of strings. What the fuck. I feel like there’s perhaps also something of a cultural difference between users of scripting languages and those of backend languages.
What you described sounds so much worse though holy shit.


I’m leaning heavily towards faked for the meme.
If you actually were trying to get collisions, you’d save all previously generated ids and check all of them for a match with the newest one.
Not only would this increase the chance of a collision (not enough that it should matter, but still), but it would more closely approximate a real use case - if you use UUIDs you’re not just in trouble if one specific id is duplicated, it’s usually a problem if any id is not unique.
But the presented snippet is simpler and shorter and is close enough to what a naive test might look like, so it’s well suited to getting the joke across.
The only way I could imagine this not being fake is if it was achieved in a noncompliant Js implementation. Which seems highly unlikely given the screenshot looks like the Chrome console.