-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
call __init__() in modules at init time #5960
Conversation
This rather sneakily sets a precedent about reserved names, implicitly make |
That name is fine with me. |
…dules are complete and initialized.
call __init__() in modules at init time
why is this order best? are you waiting to init inner modules until after the outer module is init, or before it is init, but after it is closed? |
I think officially, the order has to be undefined for now, since we have no way to guarantee it after deserialization. But I tried to pick an approach that would be less likely to cause problems. Inner modules should be init after all their outer modules are closed, so they don't try to refer to something that might not have been defined yet. I also init outer modules first, but that's less important. |
The improvement here should be obvious. Less duplication, more locality, etc.
This will also make it very easy for packages to support precompilation.
This does the simplest thing that could work, leaving the following unsolved: