Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Wouldn't it be easier to say

    if numbers == []:
       print ("The numbers list is empty")
if your intent is to express "is the list empty?" in the condition?


That condition would fail on non-list sequences, like `numbers == (1,2,3)`; the `len` version makes the code more permissive.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: