arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2209.01817cs.SE
收藏

Python代码中占主导地位的编程范式的探索性研究

An Exploratory Study on the Predominant Programming Paradigms in Python Code

Robert Dyer, Jigyasa Chauhan

摘要:

Python是一种多范式程序设计语言,完全支持面向对象(OO)编程。该语言允许以非过程的命令式方式编写代码,使用过程,使用类或函数式风格。到目前为止,还没有人研究过在Python代码和项目中占主导地位的范式(如果有的话)。在这项工作中,我们首先定义了一种将Python文件分类为主要范式的技术。然后,我们自动化我们的方法,并根据人类的判断进行评估,显示出超过80%的一致性。然后,我们分析了超过10万个开源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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑