I’m too lazy to check this myself this Sunday, so I’ll just ask…

how much of a performance penalty is paid if someone adds #Python imports statements inside a helper function body so it can be just copied and pasted around?

I guess the optimal thing would be to add the imports at the top of a module with the helpers so they occur only once when one imports the function, instead of being evaluated each time the function is called, but, in the context of didactic examples it is handy for the learner to have the helper function together with the example… but then I could move the imports to the top… but then I’m lazy, and… so many decisions…

⤋ Read More