Tuesday, January 24, 2012

Python 2, Python 3

Python 3 kinda gets different right away, for the beginner. It's not huge, just different.

The simple, free, and easy print 'Hello there!' becomes print ('Hello There!'). Doesn't look like too big a difference. Unless you're a beginner, where every single bit of unfamiliar punctuation becomes a step into darkness.

I'm planning on using Python in the classes I teach. I've already used it as one of the "broadening" languages I use. These are languages that aren't central to the class, but I give the students a bit of time with them as a way of letting them have a look at other languages, so that the language we are using doesn't become the only one they've ever seen.

So far, the core of my teaching has been around Java. We don't start right off in Java. We do some command line stuff, we get through some of the introductory concepts there and in BASIC. Then we do a lot with HTML and CSS, which is a great lead-in for more formal programming.

Python, Ruby, C, LISP and LOGO all have a place in my classroom. LOGO becomes one of the languages I use a lot with the middle school classes (6th-8th.) All my classes at least get a look at all these languages, to the Hello, World! level and maybe a bit more if time allows.

I'm strongly considering using Python as the main language for either middle school or high school or both next year. This immediately raises the version 2 or version 3 question.

One of my constraints, my time, immediately suggests an answer to this question. Python 2 is already installed on all the systems in the school lab. If I want 3, I need to go through and spend my own time installing it and checking it out on all the systems. Whereas 2 is there (2.7 right now, as I recall.) All I have to do is have the students open a command line and type 'python'.

All my systems at home are also on Python 2, except for my Windows 7 machine. It had no Python on it, I just installed the latest of the Windows easy installer versions on it last night (3.2-something, I believe.) I played with it for a bit, I'd already seen some information on the differences between 2 and 3 and was able to work my way through without any problems on the basis of those fuzzy memories. I'm not exactly a Python power user, so I only have to cover limited ground.

The same goes for my classes. The concepts we learn about controlling the computer and organizing tasks for it are more important that what language we use, or which version of a language we use. So I don't see going with 2 as a problem. I expect to have a Python 3 familiarity exercise, at least, as part of the class once we're well along and comfortable with Python in general. Just as I have familiarity exercises with different languages including those mentioned above and others that change from year to year.

Online interpreters/compilers help us do that without me having to install new software on the school computers. But those aren't adequate for our regular class work, just for "try it and see" type exercises.

So Python 2 it is. For now.

I'm planning to start doing some curriculum development with my middle schoolers in this Spring semester. They're enthusiastic about being guinea pigs for me. That'll make it easier for me to decide before year end how far to go with Python in my classes, and to have a start on the new materials for next year before summer, the time when I do most of my curriculum development.

Spring semester this year will still have me using Java with Greenfoot for my high school students. They're enthusiastic about that, too. It's been very successful for me for the past several years. It takes time and work to change directions in a class like this, the relative merits of the different languages are only one factor in the choice of language. Personally, I like both languages a lot. Each has advantages that I wish both shared.

Ruby is in the mix, too. Either for an expanded role in the class (such as replacing the time we used to spend on Windows command line), or as the main language in one or the other level of class. I try not to confuse things by introducing too many different languages, so I've got to be careful that I structure things so that one thing builds on another, rather than each new thing being something that adds confusion.

No comments:

Post a Comment