Wednesday, January 9, 2013

Invent with Python Version Dependencies

I was able to take some time in class today to work on figuring out version dependencies in the programs in Invent Your Own Computer Games in Python. I started with the obvious in the early chapters, changes to print() and input() for Python 2.7.

Then I jumped forward to the chapters that use Pygame. I installed Pygame on the lab computer I was at, which was a Mac running Lion, and was pleased to have it function without having to install all the SDL libraries. Then I tried out the example programs from chapters 17-20 in Invent with Python.

All Clear
It turns out that these all worked fine, without any modification from the code in the book. Since they're mostly a smattering of python holding together a pygame program. ;)

That means I can go around to the lab computers, install Python 2.7 and Pygame, and have that ready for when the students get to the later chapters. I'll take a part of a class period to go over the differences between 3.x and 2.x, then set them loose.

Future Changes
Meanwhile, I'm going through the exercises in the earlier chapters. In the future, I'll start the class with Python 2.7 and have them use the programs with the minimum modifications necessary to work with 2.7. That way the material in the book will still be as close as possible to the example code.

I'll also be providing the students with a page on our class website linking to the specific versions of Python and Pygame we're using in class for the different possible platforms they have at home.

No comments:

Post a Comment