Towards a Large -Scale Empirical Study of Python']Python Static Type Annotations

被引:0
|
作者
Lin, Xinrong [1 ]
Hua, Baojian [1 ]
Wang, Yang [1 ]
Pan, Zhizhong [1 ]
机构
[1] Univ Sci & Technol China, Sch Software Engn, Hefei, Peoples R China
基金
中国国家自然科学基金;
关键词
Empirical Study; !text type='Python']Python[!/text; Static Type Annotations; BUG-DENSITY; IMPACT;
D O I
10.1109/SANER56733.2023.00046
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Python, as one of the most popular and important programming languages in the era of data science, has recently introduced a syntax for static type annotations with PEP 484, to improve code maintainability, quality, and readability. However, it is still unknown whether and how static type annotations are used in practical Python projects. This paper presents, to the best of our knowledge, the first and most comprehensive empirical study on the defects, evolution and rectification of static type annotations in Python projects. We first designed and implemented a software prototype dubbed PYSCAN, then used it to scan notable Python projects with diverse domains and sizes and type annotation manners, which add up to 19,478,428 lines of Python code. The empirical results provide interesting findings and insights, such as: 1) we proposed a taxonomy of Python type annotation-related defects, by classifying defects into four categories; 2) we investigated the evolution of type annotation-related defects; and 3) we proposed automatic defect rectification strategies, generating rectification suggestions for 82 out of 110 (74.55%) defects successfully. We suggest that: 1) Python language designers should clarify the type annotation specification; 2) checking tool builders should improve their tools to suppress false positives; and 3) Python developers should integrate such checking tools into their development workflow to catch type annotation-related defects at an early development stage. We have reported our findings and suggestions to Python language designers, checking tool builders, and Python developers. They have acknowledged us and taken actions based on our suggestions. We believe these guidelines would improve static type annotation practices and benefit the Python ecosystem in general.
引用
收藏
页码:414 / 425
页数:12
相关论文
共 50 条
  • [41] Static Inference Meets Deep Learning: A Hybrid Type Inference Approach for Python']Python
    Peng, Yun
    Gao, Cuiyun
    Li, Zongjie
    Gao, Bowei
    Lo, David
    Zhang, Qirun
    Lyu, Michael
    2022 ACM/IEEE 44TH INTERNATIONAL CONFERENCE ON SOFTWARE ENGINEERING (ICSE 2022), 2022, : 2019 - 2030
  • [42] An Empirical Study of Flaky Tests in Python
    Gruber, Martin
    Lukasczyk, Stephan
    Kroiß, Florian
    Fraser, Gordon
    Lecture Notes in Informatics (LNI), Proceedings - Series of the Gesellschaft fur Informatik (GI), 2022, P-320 : 37 - 38
  • [43] Rotten green tests in Java']Java, Pharo and Python']Python An empirical study
    Aranega, Vincent
    Delplanque, Julien
    Martinez, Matias
    Black, Andrew P.
    Ducasse, Stephane
    Etien, Anne
    Fuhrman, Christopher
    Polito, Guillermo
    EMPIRICAL SOFTWARE ENGINEERING, 2021, 26 (06)
  • [44] Empirical Study of Engine Performance and Emission Parameters Using Python']Python Module
    DSilva, Rolvin
    Gopalakrishna, Binu Kottoor
    DSouza, Raison
    Kaliveer, Vinoothan
    Bhat, Thirumaleshwara
    INTERNATIONAL CONFERENCE ON EMERGING TRENDS IN MECHANICAL ENGINEERING (ETIME-2019), 2020, 2236
  • [45] An Empirical Study on the Fault-Inducing Effect of Functional Constructs in Python']Python
    Zampetti, Fiorella
    Belias, Francois
    Zid, Cyrine
    Antoniol, Giuliano
    Di Penta, Massimiliano
    2022 IEEE INTERNATIONAL CONFERENCE ON SOFTWARE MAINTENANCE AND EVOLUTION (ICSME 2022), 2022, : 47 - 58
  • [46] On lazy evaluation as a tool to optimize the efficiency of large scale numerical simulations in Python']Python
    Gross, L.
    Amirbekyan, A.
    Fenwick, J.
    Gao, L.
    Mohajeri, A.
    Muhlhaus, H.
    ICCS 2010 - INTERNATIONAL CONFERENCE ON COMPUTATIONAL SCIENCE, PROCEEDINGS, 2010, 1 (01): : 2139 - 2147
  • [47] Nengo: a Python']Python tool for building large-scale functional brain models
    Bekolay, Trevor
    Bergstra, James
    Hunsberger, Eric
    DeWolf, Travis
    Stewart, Terrence C.
    Rasmussen, Daniel
    Choo, Xuan
    Voelker, Aaron Russell
    Eliasmith, Chris
    FRONTIERS IN NEUROINFORMATICS, 2014, 7
  • [48] Data Mining of Syntax Errors in a Large-Scale Online Python']Python Course
    Lee, Jung A.
    Koprinska, Irena
    Jeffries, Bryn
    ARTIFICIAL INTELLIGENCE IN EDUCATION: POSTERS AND LATE BREAKING RESULTS, WORKSHOPS AND TUTORIALS, INDUSTRY AND INNOVATION TRACKS, PRACTITIONERS AND DOCTORAL CONSORTIUM, PT II, 2022, 13356 : 599 - 603
  • [49] Accelerometry to study fine-scale activity of invasive Burmese python']pythons (Python']Python bivittatus) in the wild
    Whitney, Nicholas M.
    White, Connor F.
    Smith, Brian J.
    Cherkiss, Michael S.
    Mazzotti, Frank J.
    Hart, Kristen M.
    ANIMAL BIOTELEMETRY, 2021, 9 (01)
  • [50] PyNetCor: a high-performance Python']Python package for large-scale correlation analysis
    Long, Shibin
    Xia, Yan
    Liang, Lifeng
    Yang, Ying
    Xie, Hailiang
    Wang, Xiaokai
    NAR GENOMICS AND BIOINFORMATICS, 2024, 6 (04)