DEV Community

Discussion on: Switch Statements in Python 3.10.

Collapse
 
alexmacniven profile image
Alex Macniven

Nice article, very much looking forward to seeing what 3.10 has to offer 😀

In your dictionary example, you can call .get(key, default) on a dict where default is returned if key isn’t a valid key. It’s great for when you’d otherwise need to handle KeyError

Collapse
 
grayhat profile image
Mwenda Harun Mbaabu

Glad you found it helpful, and thank you for additions.