
If lists are conceptually like vectors or arrays in other languages and tuples are like C structs or Pascal records,
[Skip] then
by converting from list to tuple form you've somehow muddied the data structure water just to take advantage of tuples' immutability.
In the context of literals used with the "in" operator, practices are widely divergent within the standard library and within the tutorial. Even within a single module, there were arbitrary switches between "x in [1,2,3]" and "x in (1,2,3)" and "x in 1,2,3". It seems that the list-as-arrays-tuple-as-records guideline is not meaningful or applicable in the context of the "in" operator. Proscribing tuple.__contains__ and tuple.__iter__ carrys the notion a bit too far.
Wouldn't it be better to have the peephole optimizer recognize the throwaway nature of lists
That's a good idea. Implementing it will be more straight-forward after the AST branch gets completed. Raymond