Skip to content

Instantly share code, notes, and snippets.

@CaryInVictoria
Created October 17, 2013 00:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CaryInVictoria/7017571 to your computer and use it in GitHub Desktop.
Save CaryInVictoria/7017571 to your computer and use it in GitHub Desktop.
Suggested changes to text prior to first four exercises
A Quick Look at Python
p. 5 mention parallel assignment
p. 6 naming convention: lower case
p. 8 Note how the start is always included...+ word[4:] ’Python’
Should be after the following para.
p. 8 delete "Also remember that" before "Python strings cannot be changed - they are immutable".
p. 9 "By contrast,len()and str() can work on a whole bunch of different objects (which we’ll get to later), so they aren’t tied to strings with dot notation." Not convincing. .size, for example, works with many objects in Ruby.
Playing With Lists
p. 2 "Lists are similar to strings, which are ordered sets of characters, except that the elements of a list can have
any type."" Add: something like, "Also, lists are mutable, as explained below.
p. 2 Somewhere around here, arguments to built-in functions must be enclosed in parentheses, with no spaces between the name of the function and the opening parenthesis. (Later you'll see that parentheses are also required for arguments to methods that are attached to objects.)
p. 3 top. Add an example such as >>>course[1,-2]
p. 3 near bottom. "You can also add...courses + ’Erlang’...]"
Move this before the explanation of lists being mutable, so it's something like
>>> courses + ["Erlang"]...
or equivalently, courses.append("Erlang")...
p. 4 Assignment to slices is also possible...
>>> courses[2:5]...courses[2:5]
Suggest using courses[2:] here instead.
p. 4. remove() method, add:
remove.('C++')
>>> list.remove('C++')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: list.remove(x): x not in list
p. 4. RE insert(i, str), after insert "JRuby" before pos 0,
>>> courses.insert(3,"C++")
to show how to insert at end
Maybe also:
>>> courses.insert(999,"FORTH")
>>> ['JRuby', 'Ruby', 'Erlang', 'C++', 'FORTH']
p. 4 Near bottom. Instead of:
"Add more data to our list."
"Create a new list with more data."
p. 5, near top. formatting:
>>
"Python"
, 45]
Initially, I didn't understand and thought this was a formatting problem. Perhaps change the example to make the point more obvious.
p. 5, near bottom. Note 4 spaces for indentation is recommended, not required.
p. 7 Inconsistent capitalization of first letter of each bullet point.
p. 8 Is "suite", as in "suite of code", a Python term?
p. 8 Consider giving a warning to make sure that the line following the last line of a function contains no whitespace. (That caused me some grief.}
p. 9 In first discussing a return statement, indicate if it is a BIF (presume yes) and if the expression whose value is to be returned must be enclosed in parentheses (presume yes).
Would be helpful if the example given here had a return statement.
p. 9 Would be useful to cover True and False before first
exercises.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment