Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'say,': 0.05; 'subject:Python': 0.06; 'debugging': 0.07; 'initialize': 0.07; 'arrays': 0.09; 'debugging.': 0.09; 'lawrence': 0.09; 'propagate': 0.09; 'cc:addr:python-list': 0.11; 'bug': 0.12; 'useful,': 0.14; '24,': 0.16; '8:40': 0.16; 'benjamin': 0.16; 'cc:name:python list': 0.16; 'janssen': 0.16; 'nan': 0.16; 'nans': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; 'thu,': 0.19; 'written': 0.21; '>>>': 0.22; 'memory': 0.22; 'cc:addr:python.org': 0.22; 'header:User-Agent:1': 0.23; 'fixed.': 0.24; 'initial': 0.24; 'cc:2**0': 0.24; 'values': 0.27; 'header :In-Reply-To:1': 0.27; 'am,': 0.29; 'array': 0.29; 'raise': 0.29; 'subject:end': 0.31; 'values.': 0.31; 'actual': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'useful': 0.36; 'should': 0.36; 'list': 0.37; 'clear': 0.37; 'pm,': 0.38; 'does': 0.39; 'gone': 0.61; "you'll": 0.62; 'kind': 0.63; 'real': 0.63; 'different': 0.65; 'occur': 0.65; 'to:addr:gmail.com': 0.65; 'distinctive': 0.84; 'oscar': 0.84; 'technique': 0.93; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=swAPkMQDU0QLXrc8luHbOHbT67GAOQ/1B/n4aVSEGBQ=; b=lYt8lILmZjwj86OOGDj8czeG6qp5aR62B3MXy24S3ZirgocWBsnxtoM14bw5Qgfhro Vs3jouee7sFYEjC6PCBbcORtKMNh+yCD55NNoT3rVb3Ym9H0mBKpSLTl5I0rLnNLSPSm y+GD3MeMgcTd0zva6u9nvG8rA/cSken+W+FGAYFJit1X1x14bhL/8fmw0Pw11mt9lj+L J3AT6C0TWBYudN9RrCxE6dNtOYki5r8cLuHAfwKwpFvfsMpBqscRqHHM1M8mBcGglvV5 QO2MX4Qbmlqhgm3Q2TG9UjAny/A80Uspw5NMLvb5jfrv1ayj13CK6nHdbqcFWJeXHtAl H17w== X-Received: by 10.224.137.130 with SMTP id w2mr11705300qat.43.1382711717225; Fri, 25 Oct 2013 07:35:17 -0700 (PDT) Sender: Ned Batchelder Date: Fri, 25 Oct 2013 10:35:16 -0400 From: Ned Batchelder User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.0.1 MIME-Version: 1.0 To: Mark Janssen Subject: Re: Python Front-end to GCC References: <4012031f-5334-4be8-a673-e0d8c8917fb2@googlegroups.com> <5264dbbe$0$30000$c3e8da3$5496439d@news.astraweb.com> <5265bba8$0$29981$c3e8da3$5496439d@news.astraweb.com> <526668e5$0$29981$c3e8da3$5496439d@news.astraweb.com> <52669852$0$29981$c3e8da3$5496439d@news.astraweb.com> <5266aa80$0$29981$c3e8da3$5496439d@news.astraweb.com> <5266b496$0$29981$c3e8da3$5496439d@news.astraweb.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Python List 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: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1382711725 news.xs4all.nl 15943 [2001:888:2000:d::a6]:34991 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:57527 On 10/25/13 7:55 AM, Mark Janssen wrote: > On Thu, Oct 24, 2013 at 8:40 PM, Mark Lawrence wrote: >> On 22/10/2013 18:37, Oscar Benjamin wrote: >>> OTOH why in particular would you want to initialise them with zeros? I >>> often initialise arrays to nan which is useful for debugging. > Is this some kind of joke? What has this list become? > It's a useful debugging technique to initialize memory to distinctive values that should never occur in real data. Perhaps it better to say, "pre-initialize". If the program is working correctly, then that data will be written over with actual initial values, and you'll never see the distinctive values. But if your program does encounter one of those values, it's clear that there's a bug that needs to be fixed. Additionally, if you have a number of different distinctive values, then the actual value encountered provides a clue as to what might have gone wrong. In an array of floats, initializing to NaN would be very useful, since NaNs propagate through calculations, or raise exceptions. --Ned.