Path: csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!weretis.net!feeder4.news.weretis.net!newsfeed.straub-nv.de!news2.arglkargh.de!news.wiretrip.org!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'sure.': 0.05; 'reference:': 0.07; 'integer,': 0.09; 'question:': 0.09; 'recursion': 0.09; 'pm,': 0.11; 'wrote:': 0.14; 'cache.': 0.16; 'coded': 0.16; 'definition,': 0.16; '(or': 0.22; 'header:In-Reply- To:1': 0.22; '0);': 0.22; 'mon,': 0.22; 'received:209.85.214.174': 0.23; 'received:mail-iw0-f174.google.com': 0.23; 'url:wiki': 0.24; 'example': 0.24; "didn't": 0.25; 'subject: -- ': 0.25; 'demonstrate': 0.26; 'guess': 0.26; 'correct': 0.26; 'chris': 0.27; 'object': 0.27; 'function': 0.27; 'message- id:@mail.gmail.com': 0.28; 'definition': 0.29; 'string': 0.29; 'one,': 0.31; 'zero.': 0.31; 'to:addr:python-list': 0.32; 'implemented': 0.33; 'difference': 0.35; 'url:en': 0.35; 'rather': 0.36; 'possibility': 0.36; 'received:209.85': 0.37; 'apr': 0.38; 'received:google.com': 0.38; 'reasonable': 0.38; 'url:org': 0.38; 'received:209.85.214': 0.39; 'to:addr:python.org': 0.39; 'received:209': 0.39; 'how': 0.39; "it's": 0.40; 'header:Received:5': 0.40; 'quickly,': 0.60; '2011': 0.62; '02:59': 0.84; 'pedantic,': 0.84; 'safer': 0.95 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=J+Mbae3+cFSE+wP1a9JOYpVi2JDFtxpnJXODxbQWBOM=; b=l9KnBLw7S0BxrpZoXZDA9xJmwcDM36nd5LntWwPw+oCm7S1aGcX2q1KxQOaZsLPMDL 1mmXZEvvBlBASNY7nRON9qjJ4VIXnZ4py9wJ1XRsweDFOWp2LXPyQTd0Mcaq60ukGYVe K7Rd4Oz2DujY2lTS7Um1s/kOWY9zF8wVq0cL0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=XFa1c4zyfN+MY6IMmWU/s4OoSLQ4QxrLuXdwtQjmemp8nFYvFGu+NPwItIKQKdJRPg 7roDgqdwjLBHpONklC2FIgZ8PGAnOV9imCFX0G/av3yvyIJVKj9xRV8hVXqHQuQ9Or6j k/p6E6MgtgsygsdkgwAKd23v55tURdAlTqyPo= MIME-Version: 1.0 In-Reply-To: <4DAB9C3F.20801@ieee.org> References: <8abff237-5ccd-4eb6-85c8-cdc9e87520b7@bl1g2000vbb.googlegroups.com> <90v871FkuaU1@mid.individual.net> <4daaa8a0$0$29986$c3e8da3$5496439d@news.astraweb.com> <4DAB9C3F.20801@ieee.org> Date: Mon, 18 Apr 2011 12:10:32 +1000 Subject: Re: Feature suggestion -- return if true From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 26 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1303092634 news.xs4all.nl 65870 [::ffff:82.94.164.166]:36060 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:3450 On Mon, Apr 18, 2011 at 12:04 PM, Dave Angel wrote: > On 01/-10/-28163 02:59 PM, Chris Angelico wrote: >> >> =A0 >> >> Sure. In my (somewhat contrived) example of factorials, that's going >> to be true (apart from 0! =3D 0); and if the function returns a string >> or other object rather than an integer, same thing. If there's the > > Just to be pedantic, by any reasonable definition, 0! =3D=3D one, not zer= o. > > One reference: =A0http://en.wikipedia.org/wiki/Factorial > 3rd sentence. Hm! I never thought to check the definition... I just coded it up quickly, and didn't even consider the possibility of a zero return until the cache's loophole was challenged. Guess with a more correct definition of factorial, it's even safer in the cache. Question: How many factorial functions are implemented because a program needs to know what n! is, and how many are implemented to demonstrate recursion (or to demonstrate the difference between iteration and recursion)? :) ChrisA