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


Groups > comp.lang.python > #3773

Re: learnpython.org - an online interactive Python tutorial

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <modelnine@modelnine.org>
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; '(i.e.,': 0.03; 'subject:Python': 0.04; 'typing': 0.05; 'though.': 0.07; 'typed': 0.07; 'python': 0.07; '21,': 0.09; 'contexts': 0.09; 'etc.),': 0.09; 'not?': 0.09; 'subject:tutorial': 0.09; 'weak': 0.09; 'pm,': 0.11; '>>>': 0.12; 'interfaces': 0.12; 'described': 0.14; 'wrote:': 0.14; '"copyright",': 0.16; '"credits"': 0.16; '"license"': 0.16; "'int'": 0.16; '4.3.4': 0.16; '[gcc': 0.16; 'cygwin': 0.16; 'false:': 0.16; 'iterable,': 0.16; 'iterator,': 0.16; 'objects)': 0.16; 'received:10.2': 0.16; 'traceback': 0.16; '(most': 0.16; 'input': 0.18; 'interface': 0.20; '(which': 0.21; 'header:In-Reply-To:1': 0.22; 'file,': 0.22; 'specified': 0.22; 'thu,': 0.22; '(though': 0.23; 'integer': 0.23; 'last):': 0.23; 'objects': 0.24; 'implementing': 0.25; 'chris': 0.27; 'string': 0.29; 'class': 0.29; 'explicitly': 0.29; 'themselves.': 0.29; 'variables': 0.29; 'work:': 0.29; 'probably': 0.30; '---': 0.31; '"+"': 0.31; 'operand': 0.31; 'typeerror:': 0.31; 'it.': 0.31; 'to:addr:python-list': 0.32; 'implemented': 0.33; "isn't": 0.34; 'skip:" 10': 0.34; 'difference': 0.35; 'file': 0.35; 'header:User- Agent:1': 0.35; '"",': 0.35; 'allow': 0.36; 'apr': 0.38; 'feels': 0.38; 'languages': 0.38; 'pretty': 0.38; 'received:org': 0.38; 'strong': 0.39; 'php': 0.39; 'to:addr:python.org': 0.39; 'works': 0.40; 'database,': 0.60; 'best': 0.60; '2011': 0.62; 'browser': 0.64; 'kinds': 0.67; 'subject:online': 0.77; 'schrieb': 0.84; 'type(s)': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=simple/simple; d=modelnine.org; s=modelnine1012; t=1303371048; bh=/Et/OT3IHtqTwA4YOzh4N0JP/yg4aWgp2op+rJeSiF0=; h=Message-ID:Date:From:MIME-Version:To:Subject:References: In-Reply-To:Content-Type:Content-Transfer-Encoding; b=m7L+8aG+mS1dD/a4Tptkqk6ZDbXEq9lNBfoV5Drgnbla5ZIeY5f5xiUKff+JQe2/k ElZUKC60BRXG3C6fAeoam6hZtzT715aaxgFwoLUJWmcKHFwV9K3kwYhESVOXqJyP3n 7HdZITNmJ3h9IyQ//IJ5Fy4wWyE6JWEdhEoo6yV8=
Date Thu, 21 Apr 2011 09:30:45 +0200
From Heiko Wundram <modelnine@modelnine.org>
User-Agent Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9
MIME-Version 1.0
To python-list@python.org
Subject Re: learnpython.org - an online interactive Python tutorial
References <506eb5e4-4f29-473a-8d47-2082322e005e@glegroupsg2000goo.googlegroups.com> <201104211710.19587.akabaila@pcug.org.au> <BANLkTimCG4v8j+St0aSaqkMomhyHp5VYhA@mail.gmail.com>
In-Reply-To <BANLkTimCG4v8j+St0aSaqkMomhyHp5VYhA@mail.gmail.com>
X-Enigmail-Version 1.1.1
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.687.1303371055.9059.python-list@python.org> (permalink)
Lines 42
NNTP-Posting-Host 82.94.164.166
X-Trace 1303371055 news.xs4all.nl 81478 [::ffff:82.94.164.166]:34947
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:3773

Show key headers only | View raw


Am 21.04.2011 09:19, schrieb Chris Angelico:
> On Thu, Apr 21, 2011 at 5:10 PM, Algis Kabaila <akabaila@pcug.org.au> wrote:
>> False: Python IS strongly typed, without doubt (though the
>> variables are not explicitly declared.)
> 
> Strongly duck-typed though. If I create a class that has all the right
> members, it can simultaneously be a file, an iterable, a database, and
> probably even a web browser if it feels like it. Is that strong typing
> or not?

Yes, that's strong typing, because your class only works in those
contexts that you "explicitly" allow it to work in (through implementing
an interface, be it an iterator, a file, etc.), independent of
"duck-typing" (which is pretty much described by the term
interface-based typing IMHO).

The difference between strong typing and weak typing is best described by:

Python 2.6.5 (r265:79063, Jun 12 2010, 17:07:01)
[GCC 4.3.4 20090804 (release) 1] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 1+'2'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for +: 'int' and 'str'
>>>

which means that the interface for implementing "+" on the input types
"int" and "str" isn't implemented (i.e., TypeError). Weakly typed
languages allow this to work:

modelnine@gj-celle ~ $ php
<?php echo 1+'2'; ?>
3
modelnine@gj-celle ~ $

through all kinds of type-casting magic, which isn't explicitly
specified as interfaces on the objects (PHP also has integer and string
objects) themselves.

-- 
--- Heiko.

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


Thread

learnpython.org - an online interactive Python tutorial Ron <ron.reiter@gmail.com> - 2011-04-20 10:15 -0700
  Re: learnpython.org - an online interactive Python tutorial Matty Sarro <msarro@gmail.com> - 2011-04-20 13:57 -0400
  Re: learnpython.org - an online interactive Python tutorial Terry Reedy <tjreedy@udel.edu> - 2011-04-20 18:12 -0400
  Re: learnpython.org - an online interactive Python tutorial Chris Angelico <rosuav@gmail.com> - 2011-04-21 14:07 +1000
  Re: learnpython.org - an online interactive Python tutorial Algis Kabaila <akabaila@pcug.org.au> - 2011-04-21 17:10 +1000
    Re: learnpython.org - an online interactive Python tutorial harrismh777 <harrismh777@charter.net> - 2011-04-21 02:29 -0500
  Re: learnpython.org - an online interactive Python tutorial Chris Angelico <rosuav@gmail.com> - 2011-04-21 17:19 +1000
  Re: learnpython.org - an online interactive Python tutorial Heiko Wundram <modelnine@modelnine.org> - 2011-04-21 09:30 +0200
    Re: learnpython.org - an online interactive Python tutorial harrismh777 <harrismh777@charter.net> - 2011-04-22 01:38 -0500
      Re: learnpython.org - an online interactive Python tutorial Chris Angelico <rosuav@gmail.com> - 2011-04-22 17:08 +1000
        Re: learnpython.org - an online interactive Python tutorial harrismh777 <harrismh777@charter.net> - 2011-04-23 19:37 -0500
          Re: learnpython.org - an online interactive Python tutorial Cameron Simpson <cs@zip.com.au> - 2011-04-24 12:23 +1000
            Re: learnpython.org - an online interactive Python tutorial harrismh777 <harrismh777@charter.net> - 2011-04-23 21:39 -0500
              Re: Re: learnpython.org - an online interactive Python tutorial Dave Angel <davea@ieee.org> - 2011-04-24 07:16 -0400
                Re: learnpython.org - an online interactive Python tutorial harrismh777 <harrismh777@charter.net> - 2011-04-25 01:14 -0500
      Re: learnpython.org - an online interactive Python tutorial Mel <mwilson@the-wire.com> - 2011-04-22 09:07 -0400
        Re: learnpython.org - an online interactive Python tutorial Roy Smith <roy@panix.com> - 2011-04-22 09:22 -0400
      Re: learnpython.org - an online interactive Python tutorial Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-04-22 23:28 -0700
        Re: learnpython.org - an online interactive Python tutorial flebber <flebber.crue@gmail.com> - 2011-04-23 05:49 -0700
          Re: learnpython.org - an online interactive Python tutorial Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-04-23 11:01 -0700
        Re: learnpython.org - an online interactive Python tutorial rantingrick <rantingrick@gmail.com> - 2011-04-23 08:16 -0700
      Re: learnpython.org - an online interactive Python tutorial rantingrick <rantingrick@gmail.com> - 2011-04-23 08:21 -0700
      Re: learnpython.org - an online interactive Python tutorial Dotan Cohen <dotancohen@gmail.com> - 2011-04-23 19:51 +0300
      Re: learnpython.org - an online interactive Python tutorial Tim Chase <python.list@tim.thechases.com> - 2011-04-23 12:25 -0500
      Re: learnpython.org - an online interactive Python tutorial Westley Martínez <anikom15@gmail.com> - 2011-04-23 12:38 -0700
      Re: learnpython.org - an online interactive Python tutorial Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-04-24 00:42 +0000
        Re: learnpython.org - an online interactive Python tutorial Chris Angelico <rosuav@gmail.com> - 2011-04-24 11:35 +1000
          Re: learnpython.org - an online interactive Python tutorial Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-04-24 08:13 +0000
            Re: learnpython.org - an online interactive Python tutorial Chris Angelico <rosuav@gmail.com> - 2011-04-24 18:21 +1000
        Re: learnpython.org - an online interactive Python tutorial harrismh777 <harrismh777@charter.net> - 2011-04-23 22:10 -0500
          Re: learnpython.org - an online interactive Python tutorial Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-04-24 09:18 +0000
            Re: learnpython.org - an online interactive Python tutorial harrismh777 <harrismh777@charter.net> - 2011-04-25 01:20 -0500
              Re: learnpython.org - an online interactive Python tutorial Terry Reedy <tjreedy@udel.edu> - 2011-04-25 11:43 -0400
              Re: learnpython.org - an online interactive Python tutorial Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-04-26 13:06 +1200
          Re: learnpython.org - an online interactive Python tutorial jmfauth <wxjmfauth@gmail.com> - 2011-04-24 08:15 -0700
  Re: learnpython.org - an online interactive Python tutorial Westley Martínez <anikom15@gmail.com> - 2011-04-21 07:14 -0700
  Re: learnpython.org - an online interactive Python tutorial MRAB <python@mrabarnett.plus.com> - 2011-04-21 17:13 +0100
  Re: learnpython.org - an online interactive Python tutorial Dotan Cohen <dotancohen@gmail.com> - 2011-04-23 16:45 +0300

csiph-web