Brainstorming a new worksheet for 2006

I'll be back to school on Tuesday, teaching another Python class. I'm about to throw together a web based worksheet for use in class (each student will pull it up in a browser). I'll be recycling a lot of familiar material. Just thought I'd brainstorm out loud about the contents, then whip it together, then come back here and share the URL. I want to review some of what we've done so far, include a lot of links, preview some of the content ahead. Topics: Google Earth, Celestia and Stellarium for orientation (hello world) Latitude / Longitude XML Python: shell mode primitive objects vs. collections Collections: list dictionary string tuple Expressions: list comprehensions Functions: getting started with sequences: triangular, tetrahedral numbers etc. Generators: same ground, different capabilities generator expressions ... That should be enough to get me going. I'll be back soon with that URL. It'll be a work in progress and I'll be open to feedback (positive, negative, neutral, indifferent). Kirby

That should be enough to get me going. I'll be back soon with that URL. It'll be a work in progress and I'll be open to feedback (positive, negative, neutral, indifferent). Kirby === OK, in about 90 minutes, I got this far: http://www.4dsolutions.net/ocn/winterhaven/ (of course this page will be changing as time goes on). I have a few minutes to work on my functions page before I have to go somewhere. I'll get started on that now. Kirby

kirby urner wrote:
... Python: shell mode primitive objects vs. collections Collections: list dictionary string tuple
'd move string out of Collections. It cannot have elements of a different type (there is no character type), nor is it mutable. Better to be more standard and not call it a collection. Later you can say it behaves in some ways like an ordered list of the individual characters in the string. --Scott David Daniels Scott.Daniels@Acm.Org

I think because strings are considered *sequences* that they're also legitimately *collections*. http://docs.python.org/lib/typesseq.html i.e. it's hard for me to think an object called a "sequence" wouldn't also be a "collection" (though not all collections are sequences). 's' is a sequence with one element. iter is supposed to take a "collection" as its argument, and strings may be fed to iter.
s = iter('a') s.next() 'a'
Another author who lumps strings with lists as collections is Dave Kuhlman in Python 101: "Collections are things like strings (arrays of characters), lists, tuples, and dictionaries." http://www.rexx.com/~dkuhlman/python_101/python_101.html Given there's no formal "collection interface" like in Java (a list of methods any collection must support), I suppose the concept is a little hazy around the edges in Python world. "Iterable" is perhaps better defined? SmallTalk definitely considers strings under the umbrella of collections. Currently the page reads: """ Our first practice sessions involved using Python's primitive objects, such as different types of number, plus characters. Then we started looking at collection types, which are designed to organize information in easy-to-use *data structures*. Examples of data structures are: *[a, b, c] # list {a :1, b :2, c :3} # dictionary "abc" # string (a, b, c) # tuple* Using data structures, we're able to save a lot of information in a ready-to-use form. """ It's a little ambiguous, in that I use the word 'character' but as you point out, there's no 'character' type as distinct from 'string' in Python. However, given the 8th grade audience, I think the important thing is just to get letters mixed in with numbers when we speak of 'types of object' (they're used to the idea of integers versus floats, plus one kid brought up complex -- so then we have letters too, and all the stuff you might do with 'em). ...I may reword. Keep those suggestions coming -- useful thinking on my end. Kirby On 1/1/06, Scott David Daniels <Scott.Daniels@acm.org> wrote:
kirby urner wrote:
... Python: shell mode primitive objects vs. collections Collections: list dictionary string tuple
'd move string out of Collections. It cannot have elements of a different type (there is no character type), nor is it mutable. Better to be more standard and not call it a collection. Later you can say it behaves in some ways like an ordered list of the individual characters in the string.
--Scott David Daniels Scott.Daniels@Acm.Org
_______________________________________________ Edu-sig mailing list Edu-sig@python.org http://mail.python.org/mailman/listinfo/edu-sig
participants (2)
-
kirby urner
-
Scott David Daniels