shipfeedAI news, curated daily

01:14:18 CET
21 MAY01:14:18shipfeed
pull to refreshlast sync
Just in — 30 new
§ feed · storyline

Advancing Python typing

Python's PEP 827 proposes standard type-level building blocks for introspecting and constructing types, aiming to make Python's type system more expressive without typechecker plugins or boilerplate.

Mar 2 · · primary fetch1 sourceupdated Mar 2 ·

We’re excited to share a year-long research effort aimed at making Python’s type system more expressive and composable, something closer in spirit to the programmable types in TypeScript, but carefully crafted for Python’s runtime model. The result is .PEP 827: Type Manipulation Python’s runtime is incredibly powerful: classes, methods, and even whole APIs can be generated on the fly from a few lines of code. Concepts like metaprogramming can transform class declarations, decorators can give functions and methods additional behaviors, and those are just a few examples. But Python's static typing often can’t “follow along” without typechecker plugins or boilerplate code.

PEP 827 proposes a set of standard, type-level building blocks for introspecting existing types and constructing new ones, designed to help both type checkers and runtime tooling. FastAPI creator summed up the potential impact well :Sebastián Ramírezon our post in the Python Discourse One concrete example is the familiar TypeScript utility types, like and . Here's implemented in TypeScript and Python side by side:PickOmitPick We can immediately see that the TypeScript dedicated typing syntax is short and to the…

read full article on vercel.com
§ sources1 publication · timeline below
  1. vercel.comAdvancing Python typingprimary