Hands-on Day

List Containment

In this activity, you are to design and perform an experiment and submit a writeup of your experiment and results. The topic is the semantics of the __contains__ method of the list class, which is used to evaluate a syntax such as

item in data
that determines whether the given item is in the list. Given our knowledge of a list as a sequence of references, we might re-examine the precise semantics of this built-in behavior. There are two possible hypotheses for the symantics of the Python expression, item in data.

Your job is to perform experiments to conclusively determine which of these hyptotheses is supported by Python's lists. In explaining your solution, give the text of an interpreter session (including Python's responses) that constitutes your experiment. Then clearly state your conclusion and why the experiment supports your conclusion.


Your Task

You are to complete and submit the following form. Within it, you are to:

  1. Identify the pair of students in the partnership
  2. Clearly state your claim for which is the correct hypothesis
  3. Provide evidence for your hypothesis by copying/pasting the Python code you used to perform experiments and any relevant output that was produced as a result.
  4. Explain how the evidence supports your claim, and in particular, how the observed results would have been different had the other hypothesis had been true.
  5. Extra Credit: The developers of Python surely could have chosen either of the two semantics for this behavior. Suggest why the actual semantics chosen by the developers of Python is the most useful.


Submission

One member of the pair must submit to the quiz16 folder of their git repository a single text file, named readme.txt, based upon the format of our provided template.
Michael Goldwasser
Last modified: Tuesday, 13 November 2018