Daily Archives: May 2, 2017

Moving “Python for Everybody” to Python 3

We have been teaching the Coursera Python for Everybody specialization for almost two years now and the previous course (Programming for Everybody in Python) started in early 2014. Since 2014, we have touched 1.4 million learners with over 200,000 learners completing at least one course.

We are planning on converting the all five courses in the specialization to Python 3 by June 26, 2017. Things may come up to adjust that date but at this point it looks pretty solid.

This has been about two years of effort with a new textbook, all new slides, a new autograder, and a new web site at www.py4e.com, new lecture recordings, new audio podcasts … you get the picture. Actually uploading it all to Coursera turns out to be the easiest part :)

Also, we have unlocked the fifth course (the capstone) and removed the pre-requisite requirements for the capstone. This allows students to take any of the five classes in the specialization in any order.

Why Python 3?

While there are many in the Python community still using Python 2 and many Python libraries that are Python 2, I think the time has come to teach new programmers Python 3. And if you learn Python 3 and then have to go back a bit to Python 2 in a job situation, think of it as learning a new language. But to me the time has come for teachers to teach Python 3.

Ultimately, Python 3 is a superior language and the language that will be suitable for a very long time. Probably the largest non-negotiable feature is the solid support for Unicode and all character sets. Python cannot be successful if it is only fully functional in Latin/ASCII character sets.

Why Not do Both?

We toyed with this idea for a while, letting Coursera students choose between the versions – but the effort required to keep everything working in both languages would stretch our teaching and support teams too thin. A Coursera course requires more effort than a web site. Five courses are challenging enough – if we supported both languages, we would be supporting 10 courses on Coursera.

Transition (i.e. Yikes my next class is in Python 3!)

We will be switching all of the five classes to Python 3 at the same time. This means that you may have taken one or more courses in Python 2 and then “poof” you are in Python 3 in the next course. If you encounter Python 3 for the first time in Course 2 (Data Structures) or Course 3 (Web Data) – the only difference you’ll find in the content for these courses will be thatprint with parenthesis and raw_input() becomes input().

Python 2.x:

    name = raw_input('Enter your name: ')
    print name

Python 3.x:

    name = input('Enter your name: ')
    print(name)

In Course 3 (Using Python to access web data) you will start to see the changes to the Python 3 urllib module and how we work with Beautiful Soup. We provide you with all new sample code in Python 3.

If your first encounter with Python 3 is in Course 4 (Databases) or the Course 5 (Capstone), you will need to learn about encode() and decode() and how they work with data in databases and across the network. To help with students who took Course 3 or 4 in Python 2, we have added a special lecture (Unicode in Python 3) that covers these topics in Courses 4 and 5.

Where Are the Python 2 Materials?

The Python for Informatics textbook will continue to be available on Amazon. In particular, the Chinese, Spanish and Korean versions of the Python 2 textbook will continue to be available. There are no translations of the Python 3 textbook so far.

The web site www.pythonlearn.com will continue to exist to support the Python 2 book. If there is interest, I can add the Python 2 auto-graders to that web site once the conversion of the Coursera course is complete.

Thanks

There are so many people who helped make the conversion to Python 3 possible. Here are a few that I need to thank: Sue Blumenberg, Elliott Hauser, Tamara Brunnock, Mihaela Mack, Stephen Catto, Alex Hancook, Noni Korf, Jen Vetter, Bryon Maxey, Tim O’Brien, Stephanie Haley, Sabah Baxamoosa, Laura Wandres, and many others.