Exceptions

When things go wrong

Ask a user for their age and they type "banana". Look up a walker by an id that doesn't exist. Divide by a zero that snuck through. Python doesn't quietly return nil for these โ€” it raises an exception, and unless you catch it, the program crashes right there.

In Swift you wrote do { try riskyThing() } catch { ... }, and functions that could fail were marked throws. Python's version is try / except โ€” no throws keyword needed, any line can raise.