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


Groups > comp.lang.python > #55344

Re: Tail recursion to while iteration in 2 easy steps

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <random832@fastmail.us>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'heavily': 0.04; 'overflow': 0.09; 'received:internal': 0.09; 'subject:while': 0.09; 'python': 0.11; 'suggest': 0.14; 'aggressively': 0.16; 'haskell,': 0.16; 'imo,': 0.16; 'message- id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:messagingengine.com': 0.16; 'subject:recursion': 0.16; 'essential': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'stack': 0.19; 'input': 0.22; 'programming': 0.22; 'error': 0.23; 'header:In-Reply-To:1': 0.27; 'code': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'trivial': 0.31; 'received:66': 0.35; 'but': 0.35; 'surely': 0.36; 'received:10': 0.37; 'to:addr :python-list': 0.38; 'functional': 0.39; 'to:addr:python.org': 0.39; 'from:no real name:2**0': 0.61; 'header:Message-Id:1': 0.63; 'size.': 0.65; 'optimized.': 0.84; '2013,': 0.91
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.us; h= message-id:from:to:mime-version:content-transfer-encoding :content-type:in-reply-to:references:subject:date; s=mesmtp; bh= bHtyXJHNsXQD/9yTejKHJJGuhMo=; b=dGVncLAn71uEwk2XbCHQg7EbC/m30XM3 Y4Ymnc9JRFyBoEcKTPefVpO4xYWShUdid9+dWdZBpxjpVDd0qoBPHJtJ7fK4nEe6 /NHfjNeZQikF9CbOjI4h+VHfs/9E4Fmxycr7pd/5vXUlcqoIdBCBCJuGOJ45qmgO LBW00AUvBJY=
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:from:to:mime-version :content-transfer-encoding:content-type:in-reply-to:references :subject:date; s=smtpout; bh=bHtyXJHNsXQD/9yTejKHJJGuhMo=; b=Gao fIYBoNxbJIvbpTHpLq0dmTDE3W3l0IvAfBxDyMj3zeOcTfgLGTJagrq279tiXZRo nYKbBlD6vMmwXMuobNqDj0k9NUyY7B8ehZstC8JpbpuDDpZCqG9UaIuUpOeMDgmt 6D5sW+V4LwDFbOHEPzL0LI55hCCH3r/1R6WphCUc=
X-Sasl-Enc 1rme7OQGbjOabf41DCknQkV2DLIqwzUEhC677QkF0ToY 1380722689
From random832@fastmail.us
To python-list@python.org
MIME-Version 1.0
Content-Transfer-Encoding 7bit
Content-Type text/plain
X-Mailer MessagingEngine.com Webmail Interface - ajax-ce174988
In-Reply-To <524c206d$0$29984$c3e8da3$5496439d@news.astraweb.com>
References <l2feu0$n61$1@ger.gmane.org> <mailman.619.1380717089.18130.python-list@python.org> <524c206d$0$29984$c3e8da3$5496439d@news.astraweb.com>
Subject Re: Tail recursion to while iteration in 2 easy steps
Date Wed, 02 Oct 2013 10:04:49 -0400
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 <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>
Newsgroups comp.lang.python
Message-ID <mailman.632.1380722697.18130.python-list@python.org> (permalink)
Lines 10
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1380722698 news.xs4all.nl 16008 [2001:888:2000:d::a6]:49744
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:55344

Show key headers only | View raw


On Wed, Oct 2, 2013, at 9:32, Steven D'Aprano wrote:
> Python is not as aggressively functional as (say) Haskell, but it is 
> surely an exaggeration to suggest that the failure to include tail call 
> optimization means that Python "rejects" functional programming styles. 
> You can still write you code in a functional style, it just won't be as 
> heavily optimized.

IMO, tail call optimization is essential to writing in a functional
style, since otherwise you end up with a stack overflow error on any
input above a trivial size.

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


Thread

Re: Tail recursion to while iteration in 2 easy steps random832@fastmail.us - 2013-10-02 08:31 -0400
  Re: Tail recursion to while iteration in 2 easy steps Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-10-02 13:32 +0000
    Re: Tail recursion to while iteration in 2 easy steps random832@fastmail.us - 2013-10-02 10:04 -0400
      Re: Tail recursion to while iteration in 2 easy steps Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-10-02 19:13 +0000

csiph-web