You, a coward: Python doesn't have a switch statement

Me, a modern-day Galileo:

Follow

@christianp This actually is pretty neat because if you leave out the default case, any input not listed as a case will raise an exception. Automatic bounds checking!

@invis yeah, after I tooted that I realised I should've made all the cases subclasses of a generic CaseException, then you can catch the default case and real exceptions separately.

... if you were doing this in real life, which you shouldn't

Sign in to participate in the conversation
glaceon.social

A general fediverse instance for people who generally like pokemon at least a little bit. Newly registered users must be manually approved due to an increasing number of spam bots; if you look like a person, your account will be approved as soon as possible.