On Sun, 10 Apr 2022, 8:44 am Eric V. Smith, <[email protected]> wrote:
> On 4/9/2022 4:28 PM, Terry Reedy wrote: > > On 4/9/2022 5:09 AM, Arfrever Frehtes Taifersar Arahesis wrote: > >> > >> Not only deletion, but also random assignments: > > > > Ok. Change "Manual deletion of entries from sys.modules" to "Direct > > manipulation of sys.modules" > > I'm not sure it's worth the hassle to document this. There are no doubt > hundreds of ways to break things. We can't enumerate all of them. > I thought we already explicitly said that if you directly alter the import system's data stores then it's possible to break things in non-obvious ways. If we don't, then it seems reasonable to make it explicit that the runtime *isn't* implicitly enforcing the invariants the import system expects to see, it is instead assuming that all code manipulating the data stores is cooperating to ensure those invariants hold. As the OP noted, in the context of programming languages in general, rather than Python in particular, it's a relatively unusual design choice to allow developers the ability to inadvertently (or intentionally!) corrupt the internal consistency of the import system's runtime state to the point where legal code won't run anymore (even though it's aligned with Python's generally permissive philosophy that allows even destructive actions like clearing the builtin namespace). Cheers, Nick. > Eric > > > _______________________________________________ > Python-Dev mailing list -- [email protected] > To unsubscribe send an email to [email protected] > https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/[email protected]/message/WGP7SLEIEIDPJEOU3ANSRPGHWKLMM7QE/ > Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ Python-Dev mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/DSQJVXMVAC3JXQ6H3NKLXBNPBCQHRWTC/ Code of Conduct: http://python.org/psf/codeofconduct/
