Hacker News new | ask | show | jobs
by scrollaway 2434 days ago
> My current understanding is that the log_calls method would NOT get executed during module load time!?!

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.

1 comments

Right! I missed the fact that log_calls is used as a decorator further down.