
Dec. 14, 2019
9:33 a.m.
On Fri, Dec 13, 2019, at 19:24, Steven D'Aprano wrote:
`__builtins__` is a private CPython implementation detail, so the above is always wrong in user code. Better:
Wait, it is? Is there then no portable way to do the things like: - providing an alternate __builtins__ to evaluated code, with some changed or removed - providing an alternate __builtins__ for the current module, to override things like __import__, __build_class__, etc [that cannot be simply replaced with globals] to change the behavior of import/class statements without having an effect on other modules? (This is very far from the topic of first(), and maybe belongs on python-list, but I was surprised to hear that... I don't want to start a long digression here though.)