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


Groups > comp.lang.python > #103092

Re: Guido on python3 for beginners

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: Guido on python3 for beginners
Date Thu, 18 Feb 2016 18:27:59 +1100
Lines 69
Message-ID <mailman.236.1455780482.22075.python-list@python.org> (permalink)
References <48762040-a7e0-434c-92e8-8a0969210e5b@googlegroups.com> <5d31dd14-1a60-4f80-8889-d0616f404c70@googlegroups.com> <4e902c58-3370-4adf-905d-74630a6eea90@googlegroups.com> <60036746-78f7-4f05-a6d8-04e88b09c00f@googlegroups.com> <032f0f66-34df-4325-98e0-1127025d2a94@googlegroups.com> <31a618b2-a407-4723-9a4f-9b756fc93b0b@googlegroups.com> <0a920e92-5d31-4866-815b-cae7e201e4d8@googlegroups.com> <56c568f2$0$2832$c3e8da3$76491128@news.astraweb.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de tLrI2Qz1pO6yfCrP460aCQLDm6omTG238SvI3q1kUOhw==
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'float': 0.05; '(unicode': 0.07; 'difference,': 0.07; 'cc:addr:python-list': 0.09; 'scripts': 0.09; '"python"': 0.09; 'default)': 0.09; 'integers': 0.09; 'part,': 0.09; 'php,': 0.09; 'term,': 0.09; 'python': 0.10; 'language,': 0.11; 'exception': 0.13; 'question.': 0.13; 'syntax': 0.13; 'interpreter': 0.15; 'thu,': 0.15; '2016': 0.16; 'decent': 0.16; 'division,': 0.16; 'elsewhere.': 0.16; 'encodings': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; "isn't.": 0.16; 'magic': 0.16; 'massively': 0.16; 'parentheses': 0.16; 'printf()': 0.16; 'program"': 0.16; 'py3': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:python3': 0.16; 'usage,': 0.16; 'wrote:': 0.16; 'later': 0.16; 'memory': 0.17; 'integer': 0.18; 'language': 0.19; 'changes': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; "aren't": 0.22; 'arguments': 0.22; 'either.': 0.22; 'features,': 0.22; 'suppose': 0.22; 'text,': 0.22; 'trying': 0.22; 'feb': 0.23; 'absolute': 0.23; 'errors': 0.23; '(most': 0.24; 'header:In-Reply-To:1': 0.24; 'all.': 0.24; "doesn't": 0.26; 'sense': 0.26; 'mostly': 0.27; 'question': 0.27; 'message-id:@mail.gmail.com': 0.27; 'correct': 0.28; 'function': 0.28; 'ahead.': 0.29; 'curve': 0.29; 'division': 0.29; 'does,': 0.29; 'forces': 0.29; 'i/o': 0.29; 'invoke': 0.29; 'windows,': 0.29; 'yields': 0.29; 'print': 0.30; 'call.': 0.30; 'users.': 0.31; 'aside': 0.32; 'generally': 0.32; 'statement': 0.32; 'maybe': 0.33; 'problem': 0.33; "d'aprano": 0.33; 'interaction': 0.33; 'programming,': 0.33; 'steven': 0.33; 'languages': 0.34; 'gives': 0.35; 'received:google.com': 0.35; 'clear': 0.35; 'fresh': 0.35; 'unicode': 0.35; "isn't": 0.35; 'but': 0.36; 'list,': 0.36; 'should': 0.36; 'instead': 0.36; 'there': 0.36; 'received:209.85': 0.36; 'basic': 0.36; 'keyword': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'two': 0.37; 'received:209.85.213': 0.37; 'things': 0.38; 'itself': 0.38; "won't": 0.38; 'version': 0.38; 'received:209': 0.38; 'building': 0.38; 'someone': 0.38; 'files': 0.38; 'speak': 0.38; 'system.': 0.39; 'easily': 0.39; 'where': 0.40; 'some': 0.40; 'term': 0.60; 'your': 0.60; 'back': 0.62; 'more': 0.63; 'different': 0.63; 'information': 0.63; 'times': 0.63; 'between': 0.65; 'soon': 0.65; 'benefit': 0.66; "they're": 0.66; 'life': 0.67; 'biggest': 0.67; 'levels': 0.70; 'acts': 0.72; 'advantages': 0.72; 'introduce': 0.79; '(also,': 0.84; 'chrisa': 0.84; 'ease.': 0.84; 'learn.': 0.84; "there'll": 0.84; 'to:none': 0.91; 'write()': 0.91; 'tough': 0.95
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=GoB4I3t4Yj40Cj04XrmXBlCYCtbjmXj4RgJyZYggl9k=; b=PDuxmbCh49gwg1rOEw9sqCF7Lqg0DCfPB5mwDEhkApNDZM6EWsB09KDi6vEZqMRFHu qUPNcwnf1siOtiPNhuMRzXB6g2+C6yzJA9Ki4Pg/EqmevGm6fIfii9im8B5N/abgfRT2 fiFVC7vQqlb+aYHhvXuAd7zNcGal/TkXw/eNb0ZvbupSFk2BWk+1I3VPOjqcl6yOu1z+ 1Cdf5Y1301Ay1JxKCgHXGIgLapp+1OmJxjv3iQpFgnYJr8+w+9SNLbXM4eXSh7K3ysW4 uRP4ZXQsT7E19pAaXEKu76pofT4M5y+LG5L8mPSXXus7xUkPjtWbKFFaqMuCtosdrgsB fqBg==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:cc:content-type; bh=GoB4I3t4Yj40Cj04XrmXBlCYCtbjmXj4RgJyZYggl9k=; b=iXffqcBk5geaDrU/c7azi3Y6RDJHYuK9d5XNqnTTir4FozXhF5XqcdvXndFkqTkXre DfsqgfBfvEtCl0LLSkkvcRekHICOtFxLsD8YYGJF7al04hoosasxOJ5mOsq3VfMXgaph ZMuPelZ8EpIMckkxIrP1mYSTor6R97u6tWwpliUGB7A96jhv5eGdxAIXirjKu4Rxqky6 hkmta5GislKtNsFyFy4a7uYHNxhSKo94WVpNfKD0s0LMKRrwp+CUMxPrrIwrFIwoGBSQ OrtuU/zZo4J+9S9dcEANsZStIanKOtqgTlTaal1J34NKRl2I24X9Gl7hwYChnJ25Y33S qX5Q==
X-Gm-Message-State AG10YOQH2xE2zPpXrOl9IdZTscvz7wzb3eg5vjqk02P1D/rGLiKYcJ8hjiHEVNvqsQYjUU70AyjCqYGDWaUd0g==
X-Received by 10.50.176.195 with SMTP id ck3mr1913424igc.94.1455780479145; Wed, 17 Feb 2016 23:27:59 -0800 (PST)
In-Reply-To <56c568f2$0$2832$c3e8da3$76491128@news.astraweb.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.21rc2
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:103092

Show key headers only | View raw


On Thu, Feb 18, 2016 at 5:47 PM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
> There are more features in Python 3, so in that trivial sense of "more to
> learn", I suppose that it is objectively correct that it is harder to learn
> than Python 2. But I don't think the learning curve is any steeper. If
> anything, the learning curve is ever-so-slightly less steep.

Let's see... changes in Py3.

1) Division of two integers now yields a float instead of flooring.
For someone fresh to programming, that's a Py3 advantage, although it
can cause surprises elsewhere. But since 1.0==1, it's not going to be
a problem for a new programmer. Advantage: Py3.

2) Strings are Unicode text, and files etc may need to have their
encodings declared. Definitely causes some issues in ASCII-only
situations, where a lot of other languages (notably including PHP, for
the people building web sites) let you be sloppy. Advantage: Py3 if
you speak any language other than English; otherwise Py2 in the very
short term, neither in the medium term, and most definitely Py3 in the
long term (no more "funny characters break my program" errors long
after deployment).

3) Laziness. When you explain to someone what the range() function
does, Py2 makes a list, but Py3 makes... a range. It doesn't really
answer the question at all. When you ask Py2 for a dictionary's
keys/values, you get a list; Py3 gives you a thing that mostly acts
like a list, only it isn't. If you map a function over a list, you get
back a lazy thing that will eventually call that function. Py2 often
has less levels of indirection, ergo less things to try to explain.
Advantage: Py2; the benefits (lower memory usage, etc) aren't
significant to new users.

4) Exception chaining. You get more information when errors cascade.
Advantage: Py3, easily and without any question.

5) print statement/function. Py3 forces you to put parentheses on it,
which is no different from C's printf() or Pike's write() or any
number of other languages where console I/O needs no language support.
Maybe a tiny TINY advantage to Py2 in the short term, but as soon as
you introduce the less basic features, keyword arguments are way
better than the magic syntax the statement needs. (Also, trying to
explain the interaction between the print statement's "soft space" and
other console I/O is not easy.) By the time you've really learned the
language, the advantage belongs to Py3.

6) The fact that the name "python" may not invoke the interpreter you
want. Advantage: Py2, if any; there'll be times when they're on par,
but Py3 never comes out ahead.

7) Whether or not the interpreter comes pre-installed on your system.
As of a few years ago, that was a clear advantage to Py2 (most systems
would ship with both, or neither, or Py2 only), but that's shifting.
It's only a small difference, though; on Windows, you generally get
nothing, and on any system with a decent package manager, you should
be able to request either version with ease.

It's actually a pretty tough call. Most of the Py3 advantages aren't
for the absolute beginner; it's not easier to write "Hello, world" in
Py3, and aside from the change to integer division, most of the
changes won't benefit small-to-medium scripts either. The biggest
advantage (Unicode by default) really only shows itself by sparing you
hassles later on - it's not going to make your life easier in the
short term, ergo it's not going to make the language easier to learn.
Py3 isn't so much easier as _better_. There are specific situations
where it's massively better, but for the most part, they're about on
par.

ChrisA

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


Thread

[STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Rick Johnson <rantingrickjohnson@gmail.com> - 2016-02-02 19:26 -0800
  Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO John Ladasky <john_ladasky@sbcglobal.net> - 2016-02-02 22:02 -0800
    Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Bernardo Sulzbach <mafagafogigante@gmail.com> - 2016-02-03 04:07 -0200
    Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Rick Johnson <rantingrickjohnson@gmail.com> - 2016-02-06 12:54 -0800
      Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO INADA Naoki <songofacandy@gmail.com> - 2016-02-07 12:02 +0900
        Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-02-07 16:59 +1100
          Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Paul Rubin <no.email@nospam.invalid> - 2016-02-06 23:04 -0800
            Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Rustom Mody <rustompmody@gmail.com> - 2016-02-06 23:31 -0800
              Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Paul Rubin <no.email@nospam.invalid> - 2016-02-06 23:51 -0800
                Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Chris Angelico <rosuav@gmail.com> - 2016-02-07 18:58 +1100
                Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Jason Swails <jason.swails@gmail.com> - 2016-02-08 10:20 -0500
            Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Christian Gollwitzer <auriocus@gmx.de> - 2016-02-07 08:44 +0100
      Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Chris Angelico <rosuav@gmail.com> - 2016-02-07 14:06 +1100
      Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Ian Kelly <ian.g.kelly@gmail.com> - 2016-02-08 08:40 -0700
      Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Random832 <random832@fastmail.com> - 2016-02-08 10:44 -0500
        Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO wxjmfauth@gmail.com - 2016-02-09 01:15 -0800
      Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Chris Angelico <rosuav@gmail.com> - 2016-02-09 02:46 +1100
      Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Random832 <random832@fastmail.com> - 2016-02-08 10:53 -0500
      Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Chris Warrick <kwpolska@gmail.com> - 2016-02-08 18:48 +0100
      Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO John Ladasky <john_ladasky@sbcglobal.net> - 2016-02-11 23:51 -0800
        Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Rick Johnson <rantingrickjohnson@gmail.com> - 2016-02-15 18:02 -0800
          Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Chris Angelico <rosuav@gmail.com> - 2016-02-16 13:30 +1100
          Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO John Ladasky <john_ladasky@sbcglobal.net> - 2016-02-15 21:24 -0800
            Guido on python3 for beginners Rustom Mody <rustompmody@gmail.com> - 2016-02-17 00:51 -0800
              Re: Guido on python3 for beginners Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-02-18 17:47 +1100
                Re: Guido on python3 for beginners Ben Finney <ben+python@benfinney.id.au> - 2016-02-18 17:57 +1100
                Re: Guido on python3 for beginners Paul Rubin <no.email@nospam.invalid> - 2016-02-17 22:59 -0800
                Re: Guido on python3 for beginners "Sven R. Kunze" <srkunze@mail.de> - 2016-02-18 22:37 +0100
                Re: Guido on python3 for beginners Random832 <random832@fastmail.com> - 2016-02-18 02:00 -0500
                Re: Guido on python3 for beginners Chris Angelico <rosuav@gmail.com> - 2016-02-18 18:27 +1100
                Re: Guido on python3 for beginners John Ladasky <john_ladasky@sbcglobal.net> - 2016-02-18 12:22 -0800
                Re: Guido on python3 for beginners INADA Naoki <songofacandy@gmail.com> - 2016-02-18 17:00 +0900
                Re: Guido on python3 for beginners Terry Reedy <tjreedy@udel.edu> - 2016-02-18 03:40 -0500
                Re: Guido on python3 for beginners Steven D'Aprano <steve@pearwood.info> - 2016-02-20 18:59 +1100
                Re: Guido on python3 for beginners Chris Angelico <rosuav@gmail.com> - 2016-02-18 20:57 +1100
                Re: Guido on python3 for beginners Cem Karan <cfkaran2@gmail.com> - 2016-02-18 05:57 -0500
                Re: Guido on python3 for beginners Chris Angelico <rosuav@gmail.com> - 2016-02-18 22:07 +1100
                Re: Guido on python3 for beginners Rustom Mody <rustompmody@gmail.com> - 2016-02-18 04:25 -0800
                Re: Guido on python3 for beginners Random832 <random832@fastmail.com> - 2016-02-18 10:51 -0500
                Re: Guido on python3 for beginners Steven D'Aprano <steve@pearwood.info> - 2016-02-19 12:17 +1100
                Re: Guido on python3 for beginners Rustom Mody <rustompmody@gmail.com> - 2016-02-18 19:39 -0800
                Re: Guido on python3 for beginners Steven D'Aprano <steve@pearwood.info> - 2016-02-20 13:36 +1100
                Re: Guido on python3 for beginners Larry Hudson <orgnut@yahoo.com> - 2016-02-20 00:37 -0800
                Re: Guido on python3 for beginners Grant Edwards <invalid@invalid.invalid> - 2016-02-19 15:06 +0000
                Re: Guido on python3 for beginners Rustom Mody <rustompmody@gmail.com> - 2016-02-18 19:32 -0800
                Re: Guido on python3 for beginners Matt Wheeler <m@funkyhat.org> - 2016-02-18 16:44 +0000
            Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO wxjmfauth@gmail.com - 2016-02-17 08:39 -0800
          Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Christian Gollwitzer <auriocus@gmx.de> - 2016-02-18 22:14 +0100
            Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Chris Angelico <rosuav@gmail.com> - 2016-02-19 08:54 +1100
          Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Ian Kelly <ian.g.kelly@gmail.com> - 2016-02-18 21:07 -0700
            Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO wxjmfauth@gmail.com - 2016-02-19 02:18 -0800
  Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2016-02-03 09:27 +0100
  Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Grobu <snailcoder@retrosite.invalid> - 2016-02-03 09:38 +0100
    Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO wxjmfauth@gmail.com - 2016-02-03 09:16 -0800
  Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Quivis <quivis@domain.invalid> - 2016-02-06 14:59 +0000
  Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Ethan Furman <ethan@stoneleaf.us> - 2016-02-18 18:22 -0800
    Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Jon Ribbens <jon+usenet@unequivocal.co.uk> - 2016-02-19 10:05 +0000
  Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Terry Reedy <tjreedy@udel.edu> - 2016-02-19 23:15 -0500

csiph-web