|
Ooh, seems there is a new syntax for declaring the types of kwargs [1]: from typing import TypedDict, Unpack
class Movie(TypedDict):
name: str
year: int
def foo(*kwargs: Unpack[Movie]): ...
Maybe now I'll be able to actually figure out what data to send libraries without actually reading their source code.1. https://docs.python.org/3.12/whatsnew/3.12.html#pep-692-usin... |
One could hope, but any library abusing kwargs in all their methods is showing they’re willing to go through the absolute minimum to make their code usable, let alone readable and self-documenting.