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


Groups > comp.lang.python > #82817

Re: Program calling unwanted functions

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.048
X-Spam-Evidence '*H*': 0.90; '*S*': 0.00; '22,': 0.09; 'python': 0.11; 'times,': 0.14; 'interest,': 0.16; 'unlikely': 0.16; 'wrote:': 0.18; 'user.': 0.19; 'appears': 0.22; 'input': 0.22; 'print': 0.22; 'why.': 0.24; '(or': 0.24; 'sort': 0.25; '&gt;': 0.26; 'first,': 0.26; 'least': 0.26; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'function': 0.29; "doesn't": 0.30; 'dec': 0.30; 'message-id:@mail.gmail.com': 0.30; 'usually': 0.31; 'end,': 0.31; 'something': 0.35; 'case,': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'done,': 0.36; "i'll": 0.36; 'wrong': 0.37; 'skip:& 10': 0.38; 'to:addr:python-list': 0.38; 'fact': 0.38; 'pm,': 0.38; 'explain': 0.39; 'bad': 0.39; 'to:addr:python.org': 0.39; 'called': 0.40; 'matter': 0.61; 'pick': 0.64; 'limit': 0.70; 'recursion,': 0.84; 'tricky': 0.84
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=iPTUMsnshFilTlFPEywmH7uLV23L+jhTvw+zrN07yjE=; b=BVz8GWj9kzhRFn7BsS2XHzaTo/gwY3bIM52y5pA78RUCti2ypqknoypcYc9HjT/MWS nK9bVXMIqqNuqpDqdL8yHYLOnncwbjD182v+PaEhRtyJxuas1c1qngSis2iAFfWO6gVA /czFP93yMEYUdvUs2IYOePnmYaG4QvP2MavLbimmo9+TgA73kfM8KSg9UHQ7xrq6ede8 UVw/ob4UdlfoUwGqfw7CXGcBPt3IE2LnYqj85UTjOGcy6jR8b6hDieGU/EFwnBgKb2lB HRkkpxm3sWiuDksz96Alo37Ve58xisncahlal+gkqSvravkmkoknIqJ5scxdgzWNYwaY kmDw==
MIME-Version 1.0
X-Received by 10.68.131.39 with SMTP id oj7mr39053432pbb.145.1419292124668; Mon, 22 Dec 2014 15:48:44 -0800 (PST)
In-Reply-To <5498808D.60305@davea.name>
References <b37a93ec-c90b-4375-a264-e96c3128871b@googlegroups.com> <5498808D.60305@davea.name>
Date Mon, 22 Dec 2014 16:48:44 -0700
Subject Re: Program calling unwanted functions
From Ian Kelly <ian.g.kelly@gmail.com>
To Python <python-list@python.org>
Content-Type multipart/alternative; boundary=047d7b15ab13ec6c26050ad6b26c
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.17144.1419292133.18130.python-list@python.org> (permalink)
Lines 37
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1419292133 news.xs4all.nl 2944 [2001:888:2000:d::a6]:36121
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:82817

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

On Dec 22, 2014 2:37 PM, "Dave Angel" <davea@davea.name> wrote:
>
> I'll pick on one function first, called instructions().  If the user
types something invalid, you print "Invalid input." and call the function
again.  In this case, because the call is at the end, no harm is usually
done, but it would be tricky to explain why.  If the user happened to type
the wrong input 1000 times, you'd hit a recursion limit and crash, but
that's unlikely unless you have a very stubborn user.

Point of interest, Python (or at least CPython) doesn't optimize tail-call
recursion, so in fact this sort of unbounded recursion (a "stack leak", if
you will) is equally bad no matter where it appears in the function.

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


Thread

Program calling unwanted functions Luke Tomaneng <luketomaneng@gmail.com> - 2014-12-22 11:55 -0800
  Re: Program calling unwanted functions John Gordon <gordon@panix.com> - 2014-12-22 20:09 +0000
  Re: Program calling unwanted functions Dave Angel <davea@davea.name> - 2014-12-22 15:35 -0500
  Re: Program calling unwanted functions Ian Kelly <ian.g.kelly@gmail.com> - 2014-12-22 16:48 -0700
  Re: Program calling unwanted functions Dave Angel <davea@davea.name> - 2014-12-22 18:57 -0500
    Re: Program calling unwanted functions sohcahtoa82@gmail.com - 2014-12-22 16:04 -0800
      Re: Program calling unwanted functions Ian Kelly <ian.g.kelly@gmail.com> - 2014-12-22 17:12 -0700
      Re: Program calling unwanted functions Dave Angel <davea@davea.name> - 2014-12-22 19:12 -0500

csiph-web