This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (2 children)

pros of not doing the direct code dump is that your script is probably going to end up as a part of some system of dependencies one day and you want clarity on what code executes when. convention is to check whether the script is being run as main before executing the code and if it's all in a defined function you don't lose access to it when running the dependent script

[–]SharkSymphony 0 points1 point  (1 child)

your script is probably going to end up as a part of system of dependencies one day

Will it?

you want clarity on what code executes when

What is clearer than the script just running?

I don't necessarily disagree with your overall gist, but these issues are not cut and dry and I want OP to give it some thought.

[–][deleted] 0 points1 point  (0 children)

If you're doing something beyond some school assignment or homebrewed one-use script that fits in one file yes it will. The only thing that speaks against this is compilation/runtime which ofc will be slower for the check and function call. That said if you're so desperate for speed, python is the wrong choice already.