[Python-Dev] Re: Importing a submodule doesn't always set an attribute on its parent

2022-04-11 Thread dfremont--- via Python-Dev
Brett Cannon wrote: > So we don't want to strengthen the definition at > all; best we are comfortable with is put up a warning that you don't want > to do stuff with sys.modules unless you know what you're doing. OK, thanks for the clarification. Having read through the source of importlib one to

[Python-Dev] Re: Importing a submodule doesn't always set an attribute on its parent

2022-04-09 Thread dfremont--- via Python-Dev
Thanks, Brett. I understand why the behavior happens, I just don't understand the decision to implement imports this way. Since there's no warning in the documentation that removing items from sys.modules can break the fact that "import X.Y" defines "X.Y" (note that the "behind the curtain" stuf

[Python-Dev] Importing a submodule doesn't always set an attribute on its parent

2022-04-08 Thread dfremont--- via Python-Dev
Hello, I came across what seems like either a bug in the import system or a gap in its documentation, so I'd like to run it by folks here to see if I should submit a bug report. If there's somewhere else more appropriate to discuss this, please let me know. If you import A.B, then remove A fro