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


Groups > comp.lang.python > #82818

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!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <davea@davea.name>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.054
X-Spam-Evidence '*H*': 0.89; '*S*': 0.00; '1000.': 0.09; '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; 'header:User-Agent:1': 0.23; 'why.': 0.24; '(or': 0.24; 'sort': 0.25; '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; 'usually': 0.31; 'end,': 0.31; 'something': 0.35; 'case,': 0.35; 'but': 0.35; 'done,': 0.36; "i'll": 0.36; 'wrong': 0.37; '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; 'ian': 0.60; 'mentioned': 0.61; 'matter': 0.61; 'pick': 0.64; 'received:74.208': 0.68; 'limit': 0.70; 'recursion,': 0.84; 'tricky': 0.84
Date Mon, 22 Dec 2014 18:57:06 -0500
From Dave Angel <davea@davea.name>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0
MIME-Version 1.0
To python-list@python.org
Subject Re: Program calling unwanted functions
References <b37a93ec-c90b-4375-a264-e96c3128871b@googlegroups.com> <5498808D.60305@davea.name> <CALwzidkPhDPVfw_Gx_cEDPvDmi=1mzda4uJ1HtcdwP39Cw1X_Q@mail.gmail.com>
In-Reply-To <CALwzidkPhDPVfw_Gx_cEDPvDmi=1mzda4uJ1HtcdwP39Cw1X_Q@mail.gmail.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Provags-ID V02:K0:7X8O6BjcJEKZiy+28dqyzMIAdxEpjaByt5y1GIiuDVd PTUxi4o3EOvL0vQrWiX+yUJJhTWFUmH1d3VBE8eJ2k7OMQpeno c4I8/I6JiLfHdXrWSsNu7Hmhj/PYfqXHl4ju0w219ULYwM370h AVafOSmBpzDcMw5AZKr894yZIfB2yS/YC2N3htguMSf0hOMUkU bOOdilpGuZyxRi6KLQNWmFB5niIku41U0KqSv5oQk/JUx6yF60 hsFv/Uje+3QIr5jMNDGFebopaQbGMK2UeBN79X1Bwz7tTcZGTp qscBXDD8TlIxWNS5RKVMp3uikJM19jygKYl7nvHaHAewZD4nw7 2uvHxpV4iFzu/95NOpWU=
X-UI-Out-Filterresults notjunk: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 <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.17145.1419292640.18130.python-list@python.org> (permalink)
Lines 20
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1419292640 news.xs4all.nl 2855 [2001:888:2000:d::a6]:39406
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:82818

Show key headers only | View raw


On 12/22/2014 06:48 PM, Ian Kelly wrote:
> 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.
>

Which is exactly why I mentioned the recursion limit of about 1000.


-- 
DaveA

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