Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!rt.uk.eu.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'exception': 0.03; 'output': 0.04; 'subject:Python': 0.05; 'url:bitbucket': 0.05; 'exception.': 0.07; 'broken.': 0.09; 'dict': 0.09; 'keyed': 0.09; 'raised,': 0.09; 'raised.': 0.09; 'stack': 0.15; 'included.': 0.16; 'roy': 0.16; 'stored.': 0.16; 'mon,': 0.16; 'wrote:': 0.17; 'typical': 0.17; 'exceptions': 0.22; 'subject:Questions': 0.22; 'errors': 0.23; 'second': 0.24; 'header': 0.24; 'script': 0.24; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'first,': 0.27; 'possibly': 0.27; 'message-id:@mail.gmail.com': 0.27; "doesn't": 0.28; 'record': 0.28; "d'aprano": 0.29; 'steven': 0.29; 'reporting': 0.29; 'received:209.85.215.46': 0.30; 'code': 0.31; 'traceback': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'nov': 0.35; 'similar': 0.35; 'received:209.85': 0.35; 'really': 0.36; 'but': 0.36; 'url:org': 0.36; 'does': 0.37; 'two': 0.37; 'received:209': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'your': 0.60; 'first': 0.61; 'referred': 0.62; 'between': 0.63; 'different': 0.63; 'smith': 0.71; 'sharing': 0.74; 'article': 0.78; 'alone,': 0.84; 'subject:Interview': 0.84; 'to:name:python': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=m5vpIyxpRPzL2+UE2d9m7rP3BJ7pLNFvXZMLsUOG6Yg=; b=b+aQlKrmwfzpsGyzd5ChOIOvwEP7PiUVqMCRLzgy21t6TdRhmwS2Fqy6Gx4l8azPIm WdYOvEs4oH+rtYhNRI1xggjwaHuP5bxVhcyc1v0g+2+wtr0Mp/f8euFav57j6Mnmhn+L 4p1WYNtYO4BelVI4Jn52NTojrQ3MWNcJwJVTdYv7GFZhk6TZflNeO+c9ae1vSsq/Ha0S LUoJ5YjUBLQ3ii0Ch2acI9NbAFw9IY98QeFxy1y1wvdxHjMKBxUPbLDvBcNHCf8wbuKn lM6MSDeQ4e/yp5/TD4sAZbNOPak8CAsMJCOeKOaCSyOjqVfmO7Yk+JHUyda+oxS+bjNy ON5g== MIME-Version: 1.0 In-Reply-To: References: <1193768041.349129.26350@v3g2000hsg.googlegroups.com> <55443eb7-847c-4f4c-8d04-1e6b507aac00@googlegroups.com> <50a8acdc$0$29978$c3e8da3$5496439d@news.astraweb.com> <50a911ec$0$29978$c3e8da3$5496439d@news.astraweb.com> <50a97de0$0$29983$c3e8da3$5496439d@news.astraweb.com> <50a9e5cf$0$21863$c3e8da3$76491128@news.astraweb.com> From: Ian Kelly Date: Mon, 19 Nov 2012 09:44:27 -0700 Subject: Re: Python Interview Questions To: Python Content-Type: text/plain; charset=ISO-8859-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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 24 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1353343501 news.xs4all.nl 6912 [2001:888:2000:d::a6]:51587 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:33546 On Mon, Nov 19, 2012 at 7:30 AM, Roy Smith wrote: > In article <50a9e5cf$0$21863$c3e8da3$76491128@news.astraweb.com>, > Steven D'Aprano wrote: >> >> By the way, based on the sample data you show, your script is possibly >> broken. You don't record either the line number that raises, or the >> exception raised, so your script doesn't differentiate between different >> errors that happen to occur with similar stack traces. > > You really might want to read the code I provided. Here's the reference > again: > > https://bitbucket.org/roysmith/python-tools/src/4f8118d175ed/logs/traceba > ck_helper.py > > The "header" referred to does indeed contain the exception raised. And > the line numbers are included. Here's a typical output stanza: Yes, but the dict is still keyed on the traceback alone, and only the first header for a particular traceback is stored. If two different exceptions occur at the same line of code and sharing the same traceback, the second exception would be counted as a second occurrence of the first, effectively squashing any reporting of the second exception.