|
|
|
|
|
by konschubert
2434 days ago
|
|
I have a question about a detail in the article: > But if we moved the log_to_network call out into the outer log_calls function, [...] this would no longer compile as a strict module. My current understanding is that the log_calls method would NOT get executed during module load time!?! Why would having a side effect in this function violate the intention of __strict__ ? |
|
That's incorrect. log_calls gets executed on import because it's a decorator, so equivalent to `hello_world = log_calls(hello_world)` at the top-level (which does also get executed).
log_to_network in the _wrapped() definition doesn't get executed until hello_world gets called; but outside of the definition of _wrapped does get executed.