Students’ mental models of references in Python
This paper reports on a study exploring students’ understanding of references and reference assignments. Students in an introductory programming course in Python were interviewed with respect to what happens during execution of reference assignment statements and function calls involving references. Previous research on Java has
identified two types of mental models related to reference assignment, which in this paper is referred to as the “Copy value model” and the “Copy reference model”.
An important result in this paper is that each of these models can be divided into two sub-models, giving a total of four different models where only one of them is valid. In addition, we have identified three types of mental models related to references in function calls. This gives valuable insight into students’ thinking, which can then be addressed by teachers both in class and in formative assessments. Furthermore, students in two introductory courses were asked to participate in a survey with multiple choice questions asking the students to identify the correct results of executing code examples involving references. The patterns of answers were analyzed based on the mental models identified in interviews. It was found that the identified mental models explained the most common patterns in the student responses.