Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #98043

Re: Python 2 vs Python 3 for teaching

From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: Python 2 vs Python 3 for teaching
Date 2015-11-02 01:27 +1100
Message-ID <mailman.22.1446388053.4463.python-list@python.org> (permalink)
References <CAPTjJmoPtk30rzoDOFnN5evRrd3kDtvie1E1F0Wu_DxWTsc+jA@mail.gmail.com> <CAJ4+4apy=ibu4r6d5vj707xoLYEty7MdaOtE+9oi3VOnehB+XA@mail.gmail.com>

Show all headers | View raw


On Mon, Nov 2, 2015 at 1:11 AM,  <paul.hermeneutic@gmail.com> wrote:
> On Nov 1, 2015 2:45 AM, "Chris Angelico" <rosuav@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

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: Python 2 vs Python 3 for teaching Chris Angelico <rosuav@gmail.com> - 2015-11-02 01:27 +1100
  Re: Python 2 vs Python 3 for teaching Paul Rubin <no.email@nospam.invalid> - 2015-11-01 11:47 -0800
    Re: Python 2 vs Python 3 for teaching Chris Angelico <rosuav@gmail.com> - 2015-11-02 09:03 +1100

csiph-web