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.


翻译:暂无翻译

0
下载
关闭预览

相关内容

Python是一种面向对象的解释型计算机程序设计语言,在设计中注重代码的可读性,同时也是一种功能强大的通用型语言。
专知会员服务
113+阅读 · 2021年9月22日
【干货书】Python科学编程,451页pdf
专知会员服务
132+阅读 · 2021年6月27日
【干货书】Python参考手册,210页pdf
专知会员服务
65+阅读 · 2021年4月30日
基于Python介绍算法和数据结构的在线互动书,240页pdf
专知会员服务
61+阅读 · 2021年2月3日
流畅的Python 中英文版 PDF 高清电子书
专知会员服务
84+阅读 · 2020年8月2日
Python计算导论,560页pdf,Introduction to Computing Using Python
专知会员服务
77+阅读 · 2020年5月5日
Keras François Chollet 《Deep Learning with Python 》, 386页pdf
专知会员服务
164+阅读 · 2019年10月12日
【新书】Python编程基础,669页pdf
专知会员服务
199+阅读 · 2019年10月10日
Hierarchically Structured Meta-learning
CreateAMind
27+阅读 · 2019年5月22日
Python机器学习课程(代码与教程)
专知
37+阅读 · 2019年5月13日
资源 | Python 中文书籍大集合
AI研习社
13+阅读 · 2018年12月20日
使用Python进行图像增强
AI研习社
17+阅读 · 2018年9月30日
荐书丨Python数据分析从入门到精通
程序人生
19+阅读 · 2018年3月31日
这几本Python新书特别赞
图灵教育
21+阅读 · 2018年3月1日
Python 书单:从入门到……
Linux中国
41+阅读 · 2017年8月6日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
VIP会员
最新内容
世界模型入门:从序贯决策到通用智能体
专知会员服务
5+阅读 · 10月24日
军事域更好使用人工智能的实用指南
专知会员服务
9+阅读 · 10月22日
《衡量语言模型中的作战规划能力》
专知会员服务
14+阅读 · 10月20日
Maven智能系统:帕兰提尔军事人工智能平台详解
专知会员服务
16+阅读 · 10月20日
《测试自动化框架在敏捷软件开发中的角色》
专知会员服务
8+阅读 · 10月20日
俄罗斯如何拦截乌克兰无人机与巡航导弹
专知会员服务
12+阅读 · 10月15日
《武器-目标分配问题:精确与近似求解算法》
专知会员服务
19+阅读 · 10月15日
相关VIP内容
专知会员服务
113+阅读 · 2021年9月22日
【干货书】Python科学编程,451页pdf
专知会员服务
132+阅读 · 2021年6月27日
【干货书】Python参考手册,210页pdf
专知会员服务
65+阅读 · 2021年4月30日
基于Python介绍算法和数据结构的在线互动书,240页pdf
专知会员服务
61+阅读 · 2021年2月3日
流畅的Python 中英文版 PDF 高清电子书
专知会员服务
84+阅读 · 2020年8月2日
Python计算导论,560页pdf,Introduction to Computing Using Python
专知会员服务
77+阅读 · 2020年5月5日
Keras François Chollet 《Deep Learning with Python 》, 386页pdf
专知会员服务
164+阅读 · 2019年10月12日
【新书】Python编程基础,669页pdf
专知会员服务
199+阅读 · 2019年10月10日
相关资讯
Hierarchically Structured Meta-learning
CreateAMind
27+阅读 · 2019年5月22日
Python机器学习课程(代码与教程)
专知
37+阅读 · 2019年5月13日
资源 | Python 中文书籍大集合
AI研习社
13+阅读 · 2018年12月20日
使用Python进行图像增强
AI研习社
17+阅读 · 2018年9月30日
荐书丨Python数据分析从入门到精通
程序人生
19+阅读 · 2018年3月31日
这几本Python新书特别赞
图灵教育
21+阅读 · 2018年3月1日
Python 书单:从入门到……
Linux中国
41+阅读 · 2017年8月6日
相关基金
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员