First thought: I would very much expect it to be able to do this optimization given the similar things it does for string concatenation.
But actually, I suspect it can't do this optimization simply because the name `frozendict` could be shadowed.