Python 编写干净代码的技巧

Python 编写干净代码的技巧,python,coding-style,Python,Coding Style,这里有一个python代码 def issubset(a,b): i=0 j=0 while i < len(a): c = False while j < len(b): if a[i] == b[j]: c = True j = j+1 if c: c = False else

这里有一个python代码

def issubset(a,b): i=0
 j=0
 while i < len(a):
        c = False
        while j < len(b):
            if a[i] == b[j]:
                c = True
                j = j+1 
            if c:
                c = False
            else:
                return False 
        j=0
        i = i+1
 return True
它能更干净吗? 我想有一些技巧,比如

if condition:
   <var> = True 

还有像这样的把戏吗

看起来您正在使用循环中的索引来访问数组成员。这不是蟒蛇式的

只需在数组中循环

for member in your_list:
   for member_two in second_list:
      pass

看起来您正在使用循环中的索引来访问数组成员。这不是蟒蛇式的

只需在数组中循环

for member in your_list:
   for member_two in second_list:
      pass

这可能更适合codereview。stackexchange@dm03514可能不是因为它似乎不适用于
all(b中的x代表a中的x)
或更好的
set(a)。issubset(b)
。这可能更适合于codereview。stackexchange@dm03514可能不是因为它似乎不工作
all(b中的x代表a中的x)
或者更好的
set(a).issubset(b)
。谢谢!那些if语句怎么样?看起来很麻烦,谢谢!那些if语句怎么样?它看起来很笨重
okay = okay and tempokay
for member in your_list:
   for member_two in second_list:
      pass