Are they the same thing????
while len(deque)>0:
deque.popleft()
while deque:
deque.popleft()
so basically these two condition loops can avoid poping from empty queue?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
They’re the same, but PEP 8 prefers the second version. I’m not convinced that it’s always easier to read though, so use your own judgement.
http://www.python.org/dev/peps/pep-0008/#programming-recommendations