To clarify the clarification, there’s a rule on code execution that is only applied selectively. For instead Pythonista of course do execute arbitrary code, as do games running internal code through interpretors etc.
It’s for limited use cases and not a threat to Apple, so it gets a pass.