Coding Pitfalls: Demystifying the Potential API Compatibility Risk of Variadic Parameters in Python
In Python development, developers often use variadic parameters, i.e., *args and **kwargs, to ensure backward compatibility of APIs after parameter changes or enhancements. Variadic parameters enable APIs to accept an arbitrary number of arguments. However, our preliminary investigation reveals that when an API with variadic parameters internally passes these parameters to other APIs that do not support variadic parameters, it may introduce potential compatibility issues, i.e., variadic parameter pitfalls (VPPs). In this work, we explore the prevalence and impact of VPPs by conducting an empirical study on 33 popular Python third-party libraries using a prototype tool, i.e., VPPDETECTOR. We provide recommendations to mitigate VPPs based on our findings.
Authors
- Guanping Xiao (ORCID: https://orcid.org/0000-0002-9419-4058)
- Shuai Zhang
- Guanglin He
Institutions
- Nanjing University of Aeronautics and Astronautics (CN)
Publication Details
- Published
- 2024-10-28
- DOI
- https://doi.org/10.1109/issrew63542.2024.00057
- Citations
- 1
- Primary Topic
- Computational Physics and Python Applications
- Type
- article
- Field-Weighted Citation Impact
- 0.35
Funders
- National Natural Science Foundation of China
- Natural Science Foundation of Jiangsu Province