In python is there an easier way to write 6 nested for loops?

后端 未结 11 1581
长情又很酷
长情又很酷 2020-12-04 17:49

This problem has been getting at me for a while now. Is there an easier way to write nested for loops in python? For example if my code went something like this

11条回答
  •  没有蜡笔的小新
    2020-12-04 18:40

    My personal argument would be that you're likely doing something wrong if you have 6 nested loops...

    That said, functional decomposition is what you're looking for. Refactor so some of the loops happen in seperate function calls, then call those functions.

提交回复
热议问题