Show HN: Switch-Case Construct in 3 Lines of Python
1–3 of 3 posts
Re: Show HN: Switch-Case Construct in 3 Lines of Python
#2Oh, that's clever. Had to read it a couple times to see what was happening.
Re: Show HN: Switch-Case Construct in 3 Lines of Python
#3Oh, that's clever. Had to read it a couple times to see what was happening.
Heh, thanks. It's amazing how well-suited Python's for-loop is for emulating this behavior: `break` just does exactly what you want, and you can throw in an else-block where you'd use a default in another language.