Get the latest tech news

TypedDicts are better than you think


TypedDict was introduced in PEP-589 which landed in Python 3.8. The primary use case was to create type annotations for dictionaries. For example,...

We can fix this a number of ways, for example, we can take the string'none' to mean no subscription instead, or make a new sentinel value called NoChange to indicate no changes. With the solution complete, we can now rely on the type system to check the dependency injection to see if any arguments are incorrect or missing. This is primarily intended for situations where different typed dicts intuitively should be compatible but potential mutations (deletions) can create problems.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of TypedDicts

TypedDicts