On Mon, Nov 2, 2015 at 1:11 AM, <paul.hermeneu...@gmail.com> wrote: > On Nov 1, 2015 2:45 AM, "Chris Angelico" <ros...@gmail.com> wrote: >> >> I'm proud to say that a Python tutoring company has just converted its >> course over from teaching Python 2.7 to teaching 3.x. For the >> naysayers out there, it actually wasn't much of a transition; > > This would make an excellent opportunity to develop a curriculum to teach > students how to maintain a 2.x and 3.x code base using 2to3. > > 2.x is not going away as fast as some would like.
I'd rather not use 2to3 there. If you want to maintain a library that can be used from 2.x and 3.x, it's much better to aim for the compatible middle - u prefixes on all Unicode strings, b prefixes on all byte strings, stick to ASCII where possible, etc, etc. Much easier than writing code for one branch and then converting to the other. We do have a few mentions in the course of "here's how Python 2 is different", but we're not teaching people to write libraries, so the notion of one program that can be run on multiple branches of Python isn't all that significant. If you're going to maintain a 2.x codebase, there's no knowing what kinds of coding styles it'll use - you can't depend on it being written for 2.7 - which makes it nearly impossible to try to teach in a generic way. The task of supporting a legacy codebase is always one of "learn the language, then learn the codebase"; why bother teaching things like "except ValueError, e:" or (worse) the old style of string exceptions, just in case someone runs into them somewhere? No. We teach 3.4 (because that's what's available on the Ubuntu VMs that we're recommending; anything 3.2+ will probably work just the same), and that's it. ChrisA -- https://mail.python.org/mailman/listinfo/python-list