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


Groups > comp.lang.python > #52093

Re: Newbie: static typing?

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.005
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'static': 0.04; 'argument': 0.05; 'falls': 0.09; 'yeah,': 0.09; 'contagious.': 0.16; 'finite': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'infinity': 0.16; 'infinity,': 0.16; 'integer.': 0.16; 'iterator,': 0.16; 'iterators': 0.16; 'looping': 0.16; 'reedy': 0.16; 'terminate.': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'passing': 0.19; 'aug': 0.22; 'issue.': 0.22; "aren't": 0.24; 'certainly': 0.24; 'visible': 0.24; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'implicit': 0.31; 'languages': 0.32; 'quite': 0.32; 'checking': 0.33; "i'd": 0.34; 'something': 0.35; 'operations': 0.35; 'usual': 0.35; 'test': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'yield': 0.36; 'subject:?': 0.36; 'positive': 0.37; 'to:addr :python-list': 0.38; 'issue': 0.38; 'rather': 0.38; 'to:addr:python.org': 0.39; 'skip:u 10': 0.60; 'is.': 0.60; 'guarantee': 0.63; 'skip:n 10': 0.64; 'float,': 0.84; 'careful': 0.91; '2013': 0.98
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:to :content-type; bh=n/Rh/EpqIIEz2fd/nMAXznIPMZxOntL7yCZeyiU+QJc=; b=X+TjYYOKnX0wsDnPHG4YXbhAF9hZ22Ec79rPYGig05dFA/5ybInBA0qqHCUn3GESkN ULO7Tsmu9br59YW5+siVne+Dm6qU4/0M95ac74znXrHBG/hN5zXoX+L+O3e6zVqEKA9K pAZHwzKzbYojLDRfC3E5NfQ6SlCz+esEpjKsuIoUABgkB/YwH5V1AIObWpC9a0fvqZ8w Wl0Uc7mqMXSF4MQeTJUGsrHU334LI7fGHdHDR2w7tyepatBNevd/v1a4Sz7i3SAlV5L/ vwgehbrFvfBGAeRpf4wOO2uLMkT/niwp2jdgm/wmB9gsss5uNbLieiCS12YmYfwsyArY T+gg==
MIME-Version 1.0
X-Received by 10.52.89.170 with SMTP id bp10mr154157vdb.104.1375834599724; Tue, 06 Aug 2013 17:16:39 -0700 (PDT)
In-Reply-To <ktrva4$rbd$1@ger.gmane.org>
References <ktp2jh$3a3$1@dont-email.me> <mailman.223.1375749359.1251.python-list@python.org> <ktqdkq$v3k$1@dont-email.me> <mailman.233.1375781390.1251.python-list@python.org> <ktqin6$n5u$1@dont-email.me> <CAPTjJmqz5jenHXqBdQWfoG_FUhUPQ7=TH1eS3MhVHiK2oAnjcA@mail.gmail.com> <ktrva4$rbd$1@ger.gmane.org>
Date Wed, 7 Aug 2013 01:16:39 +0100
Subject Re: Newbie: static typing?
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
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.289.1375834607.1251.python-list@python.org> (permalink)
Lines 22
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1375834607 news.xs4all.nl 15865 [2001:888:2000:d::a6]:33440
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:52093

Show key headers only | View raw


On Wed, Aug 7, 2013 at 12:02 AM, Terry Reedy <tjreedy@udel.edu> wrote:
> 3) The code falls into an infinite loop or recursion.
>
> The solution is to think before looping or recursing.  This often involves
> value checking (non-negative int or non-fractional float, for instance)
> rather than type checking in the usual static type-checking sense.

Yeah, there aren't many languages that let you declare that the
argument must be a positive integer. That's just something you have to
test for manually.

> One also needs to be careful about passing unbounded iterators to other
> functions and remember that unboundedness is contagious. (filter(pred,
> unbounded_iterator) is an unbounded iterator). Again, this is a 'value' or
> implicit sub-type issue rather than a explicit, visible 'type' issue.

Not quite always; I'd say that unboundedness is as contagious as IEEE
Infinity. Lots of operations on infinity will yield infinity, but a
few won't. itertools.islice can guarantee a finite iterator, and
takewhile may terminate. But yes, with filter() it certainly is.

ChrisA

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


Thread

Newbie: static typing? Rui Maciel <rui.maciel@gmail.com> - 2013-08-05 21:46 +0100
  Re: Newbie: static typing? Gary Herron <gary.herron@islandtraining.com> - 2013-08-05 14:07 -0700
    Re: Newbie: static typing? Rui Maciel <rui.maciel@gmail.com> - 2013-08-06 10:05 +0100
      Re: Newbie: static typing? Steven D'Aprano <steve@pearwood.info> - 2013-08-06 09:26 +0000
      Re: Newbie: static typing? Joshua Landau <joshua@landau.ws> - 2013-08-06 10:29 +0100
        Re: Newbie: static typing? Rui Maciel <rui.maciel@gmail.com> - 2013-08-06 11:12 +0100
          Re: Newbie: static typing? Burak Arslan <burak.arslan@arskom.com.tr> - 2013-08-06 16:27 +0300
          Re: Newbie: static typing? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-08-06 15:57 +0200
          Re: Newbie: static typing? Chris Angelico <rosuav@gmail.com> - 2013-08-06 15:06 +0100
          Re: Newbie: static typing? "Eric S. Johansson" <esj@harvee.org> - 2013-08-06 09:58 -0400
          Re: Newbie: static typing? Chris Angelico <rosuav@gmail.com> - 2013-08-06 15:38 +0100
      Easier to Ask Forgiveness than Permission (was: Newbie: static typing?) Ben Finney <ben+python@benfinney.id.au> - 2013-08-07 08:23 +1000
  Re: Newbie: static typing? Ian Kelly <ian.g.kelly@gmail.com> - 2013-08-05 17:38 -0600
  Re: Newbie: static typing? Ben Finney <ben+python@benfinney.id.au> - 2013-08-06 10:35 +1000
    Re: Newbie: static typing? Rui Maciel <rui.maciel@gmail.com> - 2013-08-06 10:01 +0100
      Re: Newbie: static typing? Joshua Landau <joshua@landau.ws> - 2013-08-06 10:19 +0100
        Re: Newbie: static typing? Rui Maciel <rui.maciel@gmail.com> - 2013-08-06 11:07 +0100
          Re: Newbie: static typing? Rotwang <sg552@hotmail.co.uk> - 2013-08-06 15:25 +0100
          Re: Newbie: static typing? Ben Finney <ben+python@benfinney.id.au> - 2013-08-07 08:34 +1000
      Re: Newbie: static typing? Chris Angelico <rosuav@gmail.com> - 2013-08-06 10:29 +0100
        Re: Newbie: static typing? Rui Maciel <rui.maciel@gmail.com> - 2013-08-06 11:28 +0100
          Re: Newbie: static typing? Chris Angelico <rosuav@gmail.com> - 2013-08-06 11:50 +0100
          Re: Newbie: static typing? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-08-06 18:54 -0400
          Re: Newbie: static typing? Terry Reedy <tjreedy@udel.edu> - 2013-08-06 19:02 -0400
          Re: Newbie: static typing? Chris Angelico <rosuav@gmail.com> - 2013-08-07 01:16 +0100
          RE: Newbie: static typing? "Prasad, Ramit" <ramit.prasad@jpmorgan.com.dmarc.invalid> - 2013-08-08 16:46 +0000
  Re: Newbie: static typing? Steven D'Aprano <steve@pearwood.info> - 2013-08-06 05:21 +0000
    Re: Newbie: static typing? Rui Maciel <rui.maciel@gmail.com> - 2013-08-06 10:04 +0100
  Re: Newbie: static typing? Grant Edwards <invalid@invalid.invalid> - 2013-08-06 15:05 +0000

csiph-web