Skip to content

Instantly share code, notes, and snippets.

Created Sep 12, 2009
What would you like to do?
def original():
for i in range(10):
for j in range(10):
for k in range(10):
if i == j and j == k:
yield "All equal"
elif (i == j and j != k) or (i == k and j != k):
yield "2 equal"
yield "None equal"
def original2():
return ["All equal" if i==j and j==k else (
"2 equal" if (i==j and j!=k) or (i==k and j!=k) \
else "None equal")
for i in range(10)
for j in range(10)
for k in range(10)]
assert tuple(original()) == tuple(original2())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment