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


Groups > comp.lang.python > #98043 > unrolled thread

Re: Python 2 vs Python 3 for teaching

Started byChris Angelico <rosuav@gmail.com>
First post2015-11-02 01:27 +1100
Last post2015-11-02 09:03 +1100
Articles 3 — 2 participants

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  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

#98043 — Re: Python 2 vs Python 3 for teaching

FromChris Angelico <rosuav@gmail.com>
Date2015-11-02 01:27 +1100
SubjectRe: Python 2 vs Python 3 for teaching
Message-ID<mailman.22.1446388053.4463.python-list@python.org>
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

[toc] | [next] | [standalone]


#98062

FromPaul Rubin <no.email@nospam.invalid>
Date2015-11-01 11:47 -0800
Message-ID<87y4ehzeli.fsf@nightsong.com>
In reply to#98043
Chris Angelico <rosuav@gmail.com> writes:
> 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.

The async keyword seems like one of Py3's bigger improvements and it
makes its appearance in 3.5, iirc.

[toc] | [prev] | [next] | [standalone]


#98067

FromChris Angelico <rosuav@gmail.com>
Date2015-11-02 09:03 +1100
Message-ID<mailman.37.1446415402.4463.python-list@python.org>
In reply to#98062
On Mon, Nov 2, 2015 at 6:47 AM, Paul Rubin <no.email@nospam.invalid> wrote:
> Chris Angelico <rosuav@gmail.com> writes:
>> 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.
>
> The async keyword seems like one of Py3's bigger improvements and it
> makes its appearance in 3.5, iirc.

Yeah. Not currently available to us, since we're recommending (for
consistency) that students use the Cloud 9 browser-based IDE, but I'm
sure when Ubuntu's next LTS comes out, it'll include 3.5 (or maybe
3.6), so we'll start using that then.

Taking advantage of new features can be done as we decide they're safe
to use, without needing any backward compatibility breaks (apart from,
of course, the async/await code not working on older Pythons). Hmm.
Maybe this should be a workshop... that could be fun.

ChrisA

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web