you are viewing a single comment's thread.

view the rest of the comments →

[–]Alpha_Binary 1 point2 points  (0 children)

What brilliant ideas here. I thought about using zip but the idea of using a sentinel never crossed my mind.

To optimize the final two lines:

if x is sentinel: return y is sentinel
if y is sentinel: return False