论文标题
关于Python代码中主要编程范式的探索性研究
An Exploratory Study on the Predominant Programming Paradigms in Python Code
论文作者
论文摘要
Python是一种多范式编程语言,完全支持面向对象的(OO)编程。该语言允许使用程序,类或功能样式以非核心命令的方式编写代码。迄今为止,没有人研究了Python代码和项目中主要是范式(如果有)。在这项工作中,我们首先定义一种将Python文件分类为主要范式的技术。然后,我们将方法自动化并根据人类判断进行评估,显示超过80%的协议。然后,我们分析超过100k的开源Python项目,自动对每个源文件进行分类并研究范式分布。结果表明,Python开发人员倾向于强烈偏爱OO功能。我们还观察到OO与程序范例与项目规模之间存在正相关。尽管很少有文件或项目主要功能,但我们仍然发现许多功能功能用途。
Python is a multi-paradigm programming language that fully supports object-oriented (OO) programming. The language allows writing code in a non-procedural imperative manner, using procedures, using classes, or in a functional style. To date, no one has studied what paradigm(s), if any, are predominant in Python code and projects. In this work, we first define a technique to classify Python files into predominant paradigm(s). We then automate our approach and evaluate it against human judgements, showing over 80% agreement. We then analyze over 100k open-source Python projects, automatically classifying each source file and investigating the paradigm distributions. The results indicate Python developers tend to heavily favor OO features. We also observed a positive correlation between OO and procedural paradigms and the size of the project. And despite few files or projects being predominantly functional, we still found many functional feature uses.