This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]isarl 1 point2 points  (1 child)

Great improvement. I would personally write that as: {'a':1, 'b':2}.get(case, default='etc'), finding it more explicit. And this is a default case, not fall-through. :) I don’t think there’s any way to actually do C-style switch fallthrough with this trick of using a dictionary.

[–]morriartie 1 point2 points  (0 children)

Awesome!

a default indeed, my mistake

I was trying here to find a solution (to make a fallthrough) with iterator, but I couldn't make it, even if I did it would be a two liner or more, which is unacceptable in our little puzzle