これらの2つの条件チェックは同じですか?条件簡略化でない場合はPython 3
:私は、彼らが答えたすべての人に同じl1 = []
l2 = []
if not l1 and not l2:
print ('y')
if not (l1 and l2):
print ('y')
感謝をしているかどうかを確認する方法を考えることはできません、私は速く
import time
l1 = []
l2 = []
st = time.time()
for i in range(100000000):
if not l1 and not l2:
pass
end = time.time()
print ('if not l1 and not l2: '+str(end-st))
st = time.time()
for i in range(100000000):
if not (l1 or l2):
pass
end = time.time()
print ('if not (l1 or l2): '+str(end-st))
印刷物であるかを確認するためにいくつかの基本的なタイミングを行っています
if not l1 and not l2: 8.533874750137329
if not (l1 or l2): 7.91820216178894