An Empirical Study on Dynamic Typing Related Practices in Python']Python Systems

被引:14
|
作者
Chen, Zhifei [1 ]
Li, Yanhui [1 ]
Chen, Bihuan [2 ]
Ma, Wanwangying [1 ]
Chen, Lin [1 ]
Xu, Baowen [1 ]
机构
[1] Nanjing Univ, State Key Lab Novel Software Technol, Nanjing, Jiangsu, Peoples R China
[2] Fudan Univ, Shanghai, Peoples R China
基金
国家重点研发计划; 中国国家自然科学基金;
关键词
dynamic typing; !text type='Python']Python[!/text; empirical study; BEHAVIOR;
D O I
10.1145/3387904.3389253
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
The dynamic typing discipline of Python allows developers to program at a high level of abstraction. However, type related bugs are commonly encountered in Python systems due to the lack of type declaration and static type checking. Especially, the misuse of dynamic typing discipline produces underlying bugs and increases maintenance efforts. In this paper, we introduce six types of dynamic typing related practices in Python programs, which are the common but potentially risky usage of dynamic typing discipline by developers. We also implement a tool named PYDYPE to detect them. Based on this tool, we conduct an empirical study on nine real-world Python systems (with the size of more than 460KLOC) to understand dynamic typing related practices. We investigate how widespread the dynamic typing related practices are, why they are introduced into the systems, whether their usage correlates with increased likelihood of bug occurring, and how developers fix dynamic typing related bugs. The results show that: (1) dynamic typing related practices exist inconsistently in different systems and Inconsistent Variable Types is most prevalent; (2) they are introduced into systems mainly during early development phase to promote development efficiency; (3) they have a significant positive correlation with bug occurring; (4) developers tend to add type checks or exception handling to fix dynamic typing related bugs. These results benefit future research in coding convention, language design, bug detection and fixing.
引用
收藏
页码:83 / 93
页数:11
相关论文
共 50 条
  • [1] Risky Dynamic Typing-related Practices in Python']Python: An Empirical StudyRisky Dynamic Typing-related Practices in Python']Python: An Empirical Study
    Chen, Zhifei
    Chen, Lin
    Yang, Yibiao
    Feng, Qiong
    Li, Xuansong
    Song, Wei
    [J]. ACM TRANSACTIONS ON SOFTWARE ENGINEERING AND METHODOLOGY, 2024, 33 (06)
  • [2] An Empirical Study on the Impact of Python']Python Dynamic Typing on the Project Maintenance
    Xia, Xinmeng
    Yan, Yanyan
    He, Xincheng
    Wu, Di
    Xu, Lei
    Xu, Baowen
    [J]. INTERNATIONAL JOURNAL OF SOFTWARE ENGINEERING AND KNOWLEDGE ENGINEERING, 2022, 32 (05) : 745 - 768
  • [3] What Types Are Needed for Typing Dynamic Objects? A Python']Python-Based Empirical Study
    Sun, Ke
    Chen, Sheng
    Wang, Meng
    Hao, Dan
    [J]. PROGRAMMING LANGUAGES AND SYSTEMS, APLAS 2023, 2023, 14405 : 24 - 45
  • [4] An Empirical Study of Dynamic Types for Python']Python Projects
    Xia, Xinmeng
    He, Xincheng
    Yan, Yanyan
    Xu, Lei
    Xu, Baowen
    [J]. SOFTWARE ANALYSIS, TESTING, AND EVOLUTION, SATE 2018, 2018, 11293 : 85 - 100
  • [5] An Empirical Study of Type-Related Defects in Python']Python Projects
    Khan, Faizan
    Chen, Boqi
    Varro, Daniel
    McIntosh, Shane
    [J]. IEEE TRANSACTIONS ON SOFTWARE ENGINEERING, 2022, 48 (08) : 3145 - 3158
  • [6] Empirical Study of Python']Python Call Graph
    Li, Yu
    [J]. 34TH IEEE/ACM INTERNATIONAL CONFERENCE ON AUTOMATED SOFTWARE ENGINEERING (ASE 2019), 2019, : 1274 - 1276
  • [7] An Empirical Study of Flaky Tests in Python']Python
    Gruber, Martin
    Lukasczyk, Stephan
    Krois, Florian
    Fraser, Gordon
    [J]. 2021 14TH IEEE CONFERENCE ON SOFTWARE TESTING, VERIFICATION AND VALIDATION (ICST 2021), 2021, : 148 - 158
  • [8] An Empirical Study on Bugs in Python']Python Interpreters
    Wang, Ziyuan
    Bu, Dexin
    Sun, Aiyue
    Gou, Shanyi
    Wang, Yong
    Chen, Lin
    [J]. IEEE TRANSACTIONS ON RELIABILITY, 2022, 71 (02) : 716 - 734
  • [9] Quantifying the Transition from Python']Python 2 to 3: An Empirical Study of Python']Python Applications
    Malloy, Brian A.
    Power, James F.
    [J]. 11TH ACM/IEEE INTERNATIONAL SYMPOSIUM ON EMPIRICAL SOFTWARE ENGINEERING AND MEASUREMENT (ESEM 2017), 2017, : 314 - 323
  • [10] An empirical study of fault localization in Python']Python programs
    Rezaalipour, Mohammad
    Furia, Carlo A.
    [J]. EMPIRICAL SOFTWARE ENGINEERING, 2024, 29 (04)