Comprehending Python Repetition Structures: An Eye-Tracking Study with Novice Developers
José Júnior Silva da Costa, Rohit Gheyi, José Aldo Silva da Costa, Márcio Ribeiro
Key points
From the paper's conclusion- We conducted a controlled eye-tracking experiment with 32 undergraduate students with prior Python experience to compare comprehension of for loops, while loops, recursion, and list comprehensions (LCs).
Abstract
Code comprehension is central to software maintenance and evolution, yet different Python repetition structures may impose distinct cognitive demands. We conducted a controlled eye-tracking experiment with 32 undergraduate students with prior Python experience to compare comprehension of for loops, while loops, recursion, and list comprehensions (LCs). Participants solved six comprehension tasks in a Latin Square design while we measured completion behavior and eye-tracking metrics over full snippets and construct-specific Areas of Interest (AOIs). for loops showed the lowest visual effort. Relative to for, while loops increased AOI fixation duration by up to 97% and regression count by 114%, with regressions concentrated around counter management. Recursion showed a descriptive 50% increase in regressions, mainly between the base case and recursive call. LCs increased AOI time by 62.5% and fixation duration by 80.9%, with horizontal regressions suggesting dense token-by-token parsing. LC comparisons yielded the clearest statistically significant pairwise differences, while the combined comparison of all non-for structures was significant across all eye-tracking metrics. These findings provide process-level evidence that Python repetition structures induce distinct visual-effort patterns, with implications for readability, code review, refactoring, onboarding, and maintainability.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- Eye movements reveal a dissociation between prediction and structural processing difficulty in language comprehension.Proceedings of the National Academy of Sciences of the United States of America · 2026
- Novices Comprehending Functional vs. Imperative Programs: An Eye-Tracking StudyACM Transactions on Software Engineering and Methodology · 2026
- The Age-Related Slowing in Bridging Inference Processing During Chinese Reading: An Eye-Tracking StudyBehavioral Sciences · 2026
- Eye-Tracking Analysis of Pharmacists to Improve Prescription Audit Efficiency.Biological & pharmaceutical bulletin · 2026
- Emotion Aware Code Tutor Using LLM ,Eye Gaze and Typing PatternInternational Research Journal of Modernization in Engineering Technology and Science · 2026
- Netlist Reverse Engineering Practice: Effects of Prior Knowledge, Cognitive Abilities, and Personality TraitsACM Transactions on Computer-Human Interaction · 2026