News for hackers. Stuff that matters.
Re:My Struggles with Rust by int_19h on Sunday May 07, 2017 @06:13PM (#14288001)
Exceptions in Python are used rather differently than in most other languages. Their overhead is much lower than exceptions in e.g. Java or C++, so they're routinely used to indicate expected conditions, like missing key in dictionary, or end of iterator. Since the language is dynamically typed in the first place, there's no concern about it effectively circumventing the type system.

That said, dict also has get(), which lets you specify the default value if key wasn't found (and the default default is None).

There are no comments on this comment yet.