Pregunta

This question is really puzzling me, and I cannot work it out. At the start of almost every python program, we import things. I am unsure if it is a process, as it is loading something, or if it is an input, as it is inputting the module so that I can use it.

¿Fue útil?

Solución

It is both; importing a Python module is a process that loads Python code from a file, compiles it (or loads cached bytecode), then executes the bytecode to form a module object with attributes. Loading from a file is input.

And it is neither; a process can also refer to a distinct program managed by the OS, each with its own Process ID, and input could refer to the interaction with the program after the modules have been imported, strictly limited to keyboard and mouse input.

You need to be clear what your terminology means; define "input" and "process" more clearly and you can figure out the answer from that.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top