Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'correct.': 0.07; 'bits': 0.09; 'handful': 0.09; 'lookup': 0.09; 'cc:addr:python-list': 0.11; '24,': 0.16; 'argument.': 0.16; 'assignments.': 0.16; 'calculates': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subroutine': 0.16; 'student': 0.16; 'wrote:': 0.18; 'input': 0.22; 'programming': 0.22; '(in': 0.22; 'cc:addr:python.org': 0.22; 'creating': 0.23; 'mon,': 0.24; 'cc:2**0': 0.24; 'task': 0.26; 'defined': 0.27; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'instruction': 0.29; 'message- id:@mail.gmail.com': 0.30; 'went': 0.31; 'implemented': 0.33; 'table': 0.34; 'trouble': 0.34; 'received:google.com': 0.35; 'set.': 0.36; 'should': 0.36; 'pm,': 0.38; 'simple': 0.61; 'mar': 0.68; 'college,': 0.84; 'textbook': 0.84; 'to:none': 0.92 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:cc :content-type; bh=TChgl3l12LKDN9owI11ej1kPJh2qCK7VkDRQhtpO3Y4=; b=eFqDNjJgkJblmjlm4P6VxJya8CNc2Hb893/i/LN+wSnwc/HbNI56T2BKnPA+QT9lo8 vn2vXDMfncy69G4KkN0uoU7UbeWXhiAAYzgnaulWSwH8RgJAlMtcPExgrgmg/WRlUqVm /cyGrULwHsLTViwaicMezweVgBB3sRTXieJc04C9exQvAjggceAhootBOUKJ6SIYGY7K sedznAzZZy+m7BJYzEjtbJ6S4xXWKIDtFEf68s8vD9WAY3LGmyP8xukCwtHdsbgxxJkj HoHLyPJ8NOsGDabaMQcKLiLkU7HS24V59773AOXyJX5jh35nGDUWdbFCUaeZzTPcjFQ1 +dxQ== MIME-Version: 1.0 X-Received: by 10.68.200.74 with SMTP id jq10mr1191803pbc.169.1395658709188; Mon, 24 Mar 2014 03:58:29 -0700 (PDT) In-Reply-To: <877g7j29qn.fsf@elektro.pacujo.net> References: <87fvm811i7.fsf@elektro.pacujo.net> <877g7j29qn.fsf@elektro.pacujo.net> Date: Mon, 24 Mar 2014 21:58:29 +1100 Subject: Re: loop From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 15 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1395658712 news.xs4all.nl 2975 [2001:888:2000:d::a6]:54134 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:68868 On Mon, Mar 24, 2014 at 9:04 PM, Marko Rauhamaa wrote: > Once in college, we were given assembly programming assignments. The > textbook defined an imagined 18-bit CPU and an instruction set. > > A fellow student was given the task to write a subroutine that > calculates the factorial of the argument. He went through the trouble of > creating a loop with multiplication etc. I argued (in vain) that his > solution is "wrong" from all angles; he should have implemented his > subroutine with a simple lookup table since 18 bits can only take a > handful of input values (0 through 8). The task was "calculates". If the task was "returns", then the lookup table would be correct. :) ChrisA