swcarpentry / python-novice-inflammation

Programming with Python
http://swcarpentry.github.io/python-novice-inflammation/
Other
302 stars 781 forks source link

tuples mentioned but not explained in 05-cond.md #96

Open PBarmby opened 9 years ago

PBarmby commented 9 years ago

The learning objectives for this section include "Explain the similarities and differences between tuples and lists." but this isn't really covered except briefly in the last exercise. Tuples are also mentioned later on (in 08-defensive.md).

confluence commented 9 years ago

I would suggest adding a brief explanation of tuples as immutable lists to the end of chapter 3 (03-lists.md), and moving the two exercises from the end of chapter 5 (the one about tuples and the previous one about "in-place" operators) to the end of that chapter as well. They don't have anything to do with conditional statements, but they do follow logically from the discussion about mutable and immutable types, and chapter 3 is currently much shorter than chapter 5. I am willing to create a pull request for this, since I need to do one to complete my instructor training. :)

I would also like to add a brief explanation that the "in-place" operators are just a syntactic shorthand, and don't really modify values in-place, as well an exercise which demonstrates that if two variables refer to the same list and it's modified in-place through one variable it changes for the other variable as well (unless that's mentioned elsewhere and I've missed it). I think that's a major gotcha for newcomers to programming.