[Edu-sig] What version of Python to teach ....

David MacQuigg macquigg at ece.arizona.edu
Mon Apr 20 01:25:52 CEST 2009


At 11:48 PM 4/19/2009 +0200, Gregor Lingl wrote:

>There are quite a few differences between Python 2 and Python 3 that concern the semantics of code.

Thank you Andre, Laura and Gregor.  I am changing my mind on how to deal with these differences.  I can see now that they do indeed carry important lessons, and deserve special attention.  The difference between integer and floating point division could be a whole lecture, leading to an understanding of the machine representation of numbers.

...

>How do you explain the nature of range to beginners? (Not a a rhetorical
>question, I'd really like to know different approaches how to do it!)

See our "Using Python" help page at http://pywhip.appspot.com/help for one approach.  Suggestions are welcome, especially from those with experience teaching high-school students.

In Using Python, I am assuming students are new to programming and have nothing to "unlearn" in approaching objects.  So we treat objects as nothing special, just the way you naturally store things in programs.  The first code they will see is a quick tour "Discovering Python".  In this tour we introduce 5 builtin objects (dir, help, len, list, range), and range is just an object that does something useful.

Discussion of iterators, callable objects, etc. is best left for the text or lecture (or perhaps an elaboration page that can be linked to the main Using Python page).  The main purpose of PyWhip, however, is not to teach these concepts, but make teaching them easy, because students have already practiced the syntax, much like the way I learned Spanish - participating in pre-arranged conversations, then reading the book.

The help page examples should be clear and interesting, even if we have to come back later and explain the conceptual underpinnings.
>At least you can see, that this is a much more important question
>than e. g. the parentheses around item (because of print being a
>function now  - but even here the semantic difference between a
>function and a statement is the point and not the parentheses ...)

Exactly.  Statements are simple, but awkward to extend.  Functions are versatile, but require a little more effort up front.

-- Dave



More information about the Edu-sig mailing list