Lune

ASE2021Top-tier venue

Where to Start: Studying Type Annotation Practices in Python

Wuxia Jin, Dinghong Zhong, Zifan Ding, Ming Fan, Ting Liu

Abstract

Dynamic programming languages have been embracing gradual typing, which supports optional type annotations in source code. Type-annotating a complex and long-lasting codebase is indeed a gradual and expensive process, where two issues have troubled developers. First, there is few guidance about how to implement type annotations due to the existence of non-trivial type practices; second, there is few guidance about which portion of a codebase should be type-annotated first. To address these issues, this paper investigates the patterns of non-trivial type-annotation practices and features of type-annotated code files. Our study detected six patterns of type-annotation practices, which involve recovering and expressing design concerns. Moreover, we revealed three complementary features of type-annotated files. Besides, we implemented a tool for studying optional typing practice. We suggest that: 1) design concerns should be considered to improve type annotation implementation by following at least six patterns; 2) files critical to software architecture could be type-annotated in priority. We believe these guidelines would promote a better type annotation practice for dynamic languages.

Ask Lune

Know where this paper stands in minutes, not an afternoon.

Lune can read the top-tier papers that cite it and the ones closest to it, and tells you what it claims, what came after and where it falls short, each point cited to the paper it comes from. No skimming, no AI slop.

2 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

its abstract · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Automating Just-In-Time Python Type Annotation Updating cites The evolution of type annotations in python: an empirical study
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers2

  1. The evolution of type annotations in python: an empirical studyLuca Di Grazia, Michael PradelFSE 2022 · 29 citations
  2. Automating Just-In-Time Python Type Annotation UpdatingZhipeng Xue, Zhipeng Gao, Xing Hu, Jingyuan Chen et al.ICSE 2026

Related papers

  1. PyTy: Repairing Static Type Errors in PythonYiu Wai Chow, Luca Di Grazia, Michael PradelICSE 2024 · 13 citations
  2. Taming type annotations in gradual typingJohn Peter Campora III, Sheng ChenOOPSLA 2020 · 7 citations
  3. Transitioning from structural to nominal code with efficient gradual typingFabian Muehlboeck, Ross TateOOPSLA 2021 · 8 citations
  4. Type-Based Gradual Typing Performance OptimizationJohn Peter Campora III, Mohammad Wahiduzzaman Khan, Sheng ChenPOPL 2024 · 3 citations
  5. Typed and Confused: Studying the Unexpected Dangers of Gradual TypingDominic Troppmann, Aurore Fass, Cristian-Alexandru StaicuASE 2024 · 2 citations
Dusk over the sea between two cliffs drawn in fine vertical lines