cosmologicon / pywat

Python wats
1.22k stars 99 forks source link

all and emptiness #14

Closed daneah closed 8 years ago

daneah commented 8 years ago

This is as expected. all takes in one iterable argument. By each case:

  1. True because the iterable is empty and therefore all (0) statements within the iterable are True (trivially).
  2. False because the only item in the iterable, an empty list, is falsy.
  3. True because the only item in the iterable, a list with one item in it, is thruthy.
daneah commented 8 years ago

I suppose this might be a wat for those who aren't familiar with truthiness of lists :smile: