小编lxn*_*eng的帖子

这个Python脚本可以改进吗?

这个Python代码可以改进吗?

   def build_list(types):
        for x in types:
            for a in ['short', 'long', 'average']:
                for b in ['square', 'sloped', 'average']:
                    for c in ['small', 'large', 'average']:
                        for d in ['thin', 'thick', 'average']:
                            for e in ['high', 'low', 'average']:
                                for f in [True, False]:
                                    for g in [True, False]:
                                        for h in ['flat', 'thick', 'average']:
                                            for i in ['long', 'short', 'average']:
                                                for j in [True, False]:
                                                    for k in ['thin', 'thick', 'average']:
                                                        for l in ['thin', 'thick', 'average']:
                                                            yield [x, a, b, …
Run Code Online (Sandbox Code Playgroud)

python yield

5
推荐指数
1
解决办法
127
查看次数

标签 统计

python ×1

yield ×1