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

Path csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: Python 2 vs Python 3 for teaching
Date Mon, 2 Nov 2015 01:27:24 +1100
Lines 33
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>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de BefjHw5sAIjezJFXRukl0wiG/FLczJUuXtxQpapUqyKw==
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'received:209.85.223': 0.03; 'subject:Python': 0.05; 'cc:addr:python-list': 0.09; '2to3': 0.09; 'exceptions,': 0.09; 'mentions': 0.09; 'prefixes': 0.09; 'python': 0.10; 'language,': 0.11; '2.7': 0.13; 'codebase': 0.16; 'codebase,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'tutoring': 0.16; 'valueerror,': 0.16; 'wrote:': 0.16; 'string': 0.17; 'byte': 0.18; 'stick': 0.18; 'runs': 0.18; 'library': 0.20; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; '2.x': 0.22; '3.x': 0.22; 'ascii': 0.22; 'converted': 0.22; 'am,': 0.23; 'nearly': 0.23; 'written': 0.24; 'header:In-Reply-To:1': 0.24; 'mon,': 0.24; 'compatible': 0.27; 'coding': 0.27; 'message- id:@mail.gmail.com': 0.27; 'converting': 0.27; 'branches': 0.29; 'strings,': 0.29; 'styles': 0.29; 'there.': 0.30; "i'm": 0.30; "we're": 0.30; 'code': 0.30; 'branch': 0.30; 'task': 0.30; "i'd": 0.31; 'probably': 0.31; "can't": 0.32; 'run': 0.33; 'legacy': 0.33; 'ubuntu': 0.33; 'received:google.com': 0.35; 'generic': 0.35; 'nov': 0.35; 'possible,': 0.35; 'unicode': 0.35; "isn't": 0.35; 'but': 0.36; 'received:209.85': 0.36; "wasn't": 0.36; 'subject:: ': 0.37; 'being': 0.37; 'there,': 0.37; 'say': 0.37; 'things': 0.38; 'received:209': 0.38; 'anything': 0.38; 'someone': 0.38; 'why': 0.39; 'rather': 0.39; 'where': 0.40; 'some': 0.40; 'company': 0.60; 'no.': 0.62; 'course': 0.62; 'other.': 0.64; 'teaching': 0.69; 'teach': 0.70; '"here\'s': 0.84; '"learn': 0.84; '2:45': 0.84; '3.4': 0.84; 'chrisa': 0.84; 'etc,': 0.84; 'to:none': 0.91; 'notion': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=nBA0rtsg7OssYZi/1dUVBg5SlUi5/Cs5bv7YQ20pCV4=; b=n8LaLECoYAGPS1utO/pBWIkU1I8ax2uoPiJUsE6dzIpSSYSeMGU6eZn5Fw/zbAG2O6 Iq1wYvsEyWoB2ou+rG/yG8LAS07SJ8tUXV6TX0d6snaVwB09p0n2T+BzPOiafI0nQZrt ypAPxXZRrfra0/Ali3WUYdEu6TmPRczO9557dQ0jafYulLkuDicMy681NctHLfmZoimC Alzk4p2vZvEZbpK0ulS/EUD7H+ogfIazoFDEG2MjNwnRIGueVlCfMx4hYaWrHl69FwmC aBlCLhSHOjEz7Br/5h9twgm6JwHdOH3u7a24zdt0xoCcS1zw68caaQ5SH8kNiFZNqxqw 3Z5g==
X-Received by 10.107.10.210 with SMTP id 79mr18413804iok.31.1446388044582; Sun, 01 Nov 2015 06:27:24 -0800 (PST)
In-Reply-To <CAJ4+4apy=ibu4r6d5vj707xoLYEty7MdaOtE+9oi3VOnehB+XA@mail.gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:98043

Show key headers only | 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