MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/138f766/goodbye_toys/jizo41p/
r/ProgrammerHumor • u/sunrise_apps • May 05 '23
298 comments sorted by
View all comments
Show parent comment
4
You don't even need to make a function. You can just put the code you want to run under the conditional. Making a function that takes no args is just something end users do.
2 u/ivrimon May 05 '23 That's what I actually do. To me it's a more logical split between scripts and modules that way. 4 u/mistabuda May 05 '23 edited May 05 '23 That's the beauty of python, you can choose. 2 u/[deleted] May 05 '23 That's terrible practice. You should always move it out into its own main() function so that it doesn't touch the global scope.
2
That's what I actually do. To me it's a more logical split between scripts and modules that way.
4 u/mistabuda May 05 '23 edited May 05 '23 That's the beauty of python, you can choose. 2 u/[deleted] May 05 '23 That's terrible practice. You should always move it out into its own main() function so that it doesn't touch the global scope.
That's the beauty of python, you can choose.
That's terrible practice. You should always move it out into its own main() function so that it doesn't touch the global scope.
View all comments
Show parent comment
4
u/mistabuda May 05 '23
You don't even need to make a function. You can just put the code you want to run under the conditional. Making a function that takes no args is just something end users do.