arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2203.16718cs.SE
收藏

大规模比较Python代码在Python Notebooks和Python

A Large-Scale Comparison of Python Code in Jupyter Notebooks and Scripts

Konstantin Grotov, Sergey Titov, Vladimir Sotnikov, Yaroslav Golubev, Timofey Bryksin

摘要:

近年来,Xueyter笔记本电脑在软件工程的多个领域越来越受欢迎,例如数据科学、机器学习和计算机科学教育。它们的流行与其丰富的功能,用于呈现和可视化数据,但是,最近的研究表明,笔记本电脑也有很多缺点:大量的代码克隆,低再现性等,在这项工作中,我们进行了比较Python代码写在笔记本电脑和传统的Python脚本。我们从两个角度比较代码:结构和风格。在分析的第一部分中,我们报告了行数、函数的使用以及各种复杂性指标的差异。在第二部分中,我们展示了文体问题数量的差异,并对所研究的媒体中最常见的15个文体问题进行了广泛的概述。总的来说,我们证明了笔记本电脑的特点是较低的代码复杂性,但是,他们的代码可以被认为是比在脚本更纠缠。至于风格,笔记本往往有1.4倍的风格问题,但同时,其中一些是由笔记本中的特定编码实践引起的,应被视为误报。通过这项研究,我们希望为研究笔记本电脑的具体问题铺平道路,这些问题应该通过开发笔记本电脑专用工具来解决,并提供在这方面有用的各种见解。

英文摘要:

In recent years, Jupyter notebooks have grown in popularity in several domains of software engineering, such as data science, machine learning, and computer science education. Their popularity has to do with their rich features for presenting and visualizing data, however, recent studies show that notebooks also share a lot of drawbacks: high number of code clones, low reproducibility, etc. In this work, we carry out a comparison between Python code written in Jupyter Notebooks and in traditional Python scripts. We compare the code from two perspectives: structural and stylistic. In the first part of the analysis, we report the difference in the number of lines, the usage of functions, as well as various complexity metrics. In the second part, we show the difference in the number of stylistic issues and provide an extensive overview of the 15 most frequent stylistic issues in the studied mediums. Overall, we demonstrate that notebooks are characterized by the lower code complexity, however, their code could be perceived as more entangled than in the scripts. As for the style, notebooks tend to have 1.4 times more stylistic issues, but at the same time, some of them are caused by specific coding practices in notebooks and should be considered as false positives. With this research, we want to pave the way to studying specific problems of notebooks that should be addressed by the development of notebook-specific tools, and provide various insights that can be useful in this regard.

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

↑