Inlined typed dicts and typed dict comprehensions

I gave a shot at writing a draft document, introducing a new syntax to produce typed dictionaries. In a nutshell:

type Movie = <{'name': str, 'location': <{'city': str}>}>

type PartialMovie = <{K: NotRequired[ValueOf[Movie, K]] for K in KeyOf[Movie]}>

The document preview is available here: https://viicos-peps–1.org.readthedocs.build/en/1/pep-9999/.

The document is mostly incomplete, and raises a lot of open questions still (some of them are available in the Github PR). Before trying to answers these questions (and whether <...> is the right syntax), I’d like to get feedback on the general feeling, especially in terms of work required to introduce this into the language:

  • Is the motivation enough to add a dedicated syntax? History showed this isn’t easy (more on that in the PEP 677 section of Why can’t we…?).
  • Will this add too much at once? This adds two special forms (KeyOf and ValueOf), and new type level operations, on top of the added inline syntax. In earlier discussions, people were also worried about adding new members to typing that had a limited scope (which is the case of those two special forms).
  • I assume having the new syntax will require moving the TypedDict logic in C. This looks difficult, especially as the logic is quite complex, and requires calling the annotationlib functions.

cc @Jelle @erictraut