The documentation for the locals() function specifically warns not to modify its output, as interpreters may not reflect changes in the local scope. I'm assuming that means the Python spec doesn't require it, even though it works in CPython.
I'd like to know if this is the same for globals(). There's no warning in the documentation, but I find it strange that this would differ as each function apparently performs the same action on a different scope.
If it's safe, modifying globals()' output would improve the simplicity and compatibility of a project I'm working on.