The python documentation says:
"One particular module deserves some attention: sys, which is built into every Python interpreter."
My understanding is that if a module is built into the Python interpreter itself, then there is no need for an explicit import statement. If the sys module is built-in the Python interpreter, then why is an explicit import statement required for the sys module?
sys is imported at Python startup. So when you import sys, it does not actually do anything except bind a variable name to the already-existing module.
When creating a module instance, there is no reason to have the sys name bound in the module scope when many (probably most) modules don't need to use sys. So, that name is not in scope by default.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With