Skip to content

Instantly share code, notes, and snippets.

@chomy
Created November 25, 2013 07:49
Show Gist options
  • Select an option

  • Save chomy/7637822 to your computer and use it in GitHub Desktop.

Select an option

Save chomy/7637822 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
a = [True, True, False, True]
reduce(lambda x,y: x and y, a, True) #-> False
a[2] = True
reduce(lambda x,y: x and y, a, True) #-> True
b = [None, None, 1, None]
reduce(lambda x,y: x and (y==None), b, True) #-> False
b[2] = None
reduce(lambda x,y: x and (y==None), b, True) #-> True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment