Reproduce “Navigating the Python Type Jungle” on OpenResearch

Turn your favorite coding agents into research agents that review literature, develop hypotheses, and run experiments.

Universal app for Apple silicon and Intel. Requires macOS 11 or later.

About this paper

Andrei Nacu, Dorel Lucanu

A formal framework is proposed for Python's diverse type system, unifying its pragmatic features like runtime classes, protocols, and type hints under Abstract Data Types and existential types. The resulting Pythonic Type System (PyTS) provides a two-layered model that distinguishes value types from meta-level class types, laying groundwork for future type inference.

Key insights

  • Python's object model allows its diverse type system to be elegantly described by mapping every class to an Abstract Data Type, which in turn corresponds to an existential type.
  • The intricate relationships within Python's type landscape can be clarified by formally distinguishing three paths: explicit inheritance (`subclass-of`), instance relationships (`object-instance-of`), and structural adherence (`type-instance-of`).
  • Existential types serve as a unifying theoretical framework to formalize Python's pragmatic type-related concepts, providing a coherent model for its hybrid dynamic and statically-annotated nature.

Summary by alphaXiv.

Tip: change arxiv.org to autoarxiv.org in any arXiv abstract link to open the paper here.