This program is tentative and subject to change.
Understanding scope rules, the rules for the binding of variable uses with variable declarations, is a necessary skill for reading and understanding program code. It is also one that novice programmers often find challenging. To better understand which misconceptions novice Python programmers commonly hold about scope rules, we pose the question of “To what extent do misconceptions exist even for a simple subset of scope rule features?”. The answer to this question can determine the level of complexity of scope rule features the instructor should focus on.
We consider a subset of Python that only has non-recursive and non-nested function definitions, scalar variables, and global code that calls the function definitions. We also consider the variable categorization into local variables, parameters, and global variables. We developed an assessment tool that we used as part of the final examination in a CS1 course for three semesters. We found that though there were significant misconceptions for some features, the number of such features is limited. This identification of the common misconceptions for this subset of Python can aid in revising the instructional focus to help future students better understand scope rules.