🐵 Max Question to (python) devs. How do you handle cognitive complexity in the main function? I usually manage to design small side functions but vscode complains about the main one having either too much parameters or a high cognitive complexity. It's usually due to nested loops that I don't manage to separate.
😏 Yt L. What do you mean by main function? Is this a kind of game dev thing? I handle functions that are too complicated by refactoring such that a function does a single thing. If many things need to be done I write many functions.
3y, 35w 1 reply
🐵 Max More precisely this is a video processing thing but yeah, the idea is that it is based on an infinite loop. Inside that loop some processing happens, files are saved or passed to something, etc. All sorts of things that I would like to put in separate functions but at some point every action is nested inside some condition or for loop so I don't manage to write meaningful subfunctions. Then vscode complains about the high number of conditions inside this single function.
3y, 34w reply
Login or register your account to reply