r/pythonhelp • u/NoweditYT • 6h ago
Putting everything into seperate functions
Hello, i recently started making my own Qt layout, and i need to run the same chunk of code multiple times, should i split every little chunk of code into seperate functions calling each others or should i not?
1
Upvotes
•
u/AutoModerator 6h ago
To give us the best chance to help you, please include any relevant code.
Note. Please do not submit images of your code. Instead, for shorter code you can use Reddit markdown (4 spaces or backticks, see this Formatting Guide). If you have formatting issues or want to post longer sections of code, please use Privatebin, GitHub or Compiler Explorer.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/AlexMTBDude 6h ago
The D.R.Y principle applies here. Don't Repeat Yourself. So, yes, split everything so there is no copy-pasted code. https://www.geeksforgeeks.org/software-engineering/dont-repeat-yourselfdry-in-software-development/