Python Interview Questions

Ian Kelly ian.g.kelly at gmail.com
Mon Nov 19 11:44:27 EST 2012


On Mon, Nov 19, 2012 at 7:30 AM, Roy Smith <roy at panix.com> wrote:
> In article <50a9e5cf$0$21863$c3e8da3$76491128 at news.astraweb.com>,
>  Steven D'Aprano <steve+comp.lang.python at pearwood.info> 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.



More information about the Python-list mailing list