Work

An Empirical Study to Understand Pythonic Lists and Dictionaries Usage in Textbooks

Year: 2024
Type: dissertation
Abstract: Coding in a 'Pythonic Way' involves writing code in a manner that is idiomatic and natural for the Python language, aligning with its philosophy and community conventions. Despite recent efforts to understand various aspects of Pythonic coding, there is still a lack of knowledge regarding how educators transition from non-idiomatic code to Pythonic equivalents. This study focuses on data structures and their introduction in textbooks.I analyze examples of traditional data structures (such as lists and dictionaries) and search for their Pythonic representations. From a dataset of 1,624 examples extracted from 177 curated Python textbooks, I address two research questions. Surprisingly, 69 out of the 177 textbooks lacked any examples of data structures, let alone Pythonic code. The results provide insights into scenarios where using traditional non-Pythonic data structures might still be preferred, considering specific topics (e.g., data science, visualization, statistics), comparison scenarios (readability vs. performance), and other reasons. This work highlights the limited prevalence of Pythonic education and suggests the direction for constructing and maintaining the Zen of Python in the next generation of Python programmers by raising the concern about the importance of introducing the Pythonic code when teaching Python programming.
Language: English
Open Access status: green
OpenAlex ID: W7207958067
Cites: 24
Cited by:
Related to: 10