Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!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.024 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'cc:addr:python-list': 0.09; 'generators': 0.09; 'iterate': 0.09; 'exception': 0.13; 'stack': 0.13; 'def': 0.13; 'subsequent': 0.15; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'generator.': 0.16; 'trace.': 0.16; 'traceback.': 0.16; 'wrote:': 0.16; "wouldn't": 0.16; 'instance,': 0.18; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; "aren't": 0.22; 'header:In-Reply-To:1': 0.24; "doesn't": 0.26; 'appear': 0.26; 'figure': 0.27; 'error': 0.27; 'fri,': 0.27; 'room': 0.27; 'message-id:@mail.gmail.com': 0.27; 'yield': 0.27; 'function': 0.28; 'itself,': 0.29; 'strings,': 0.29; 'subject:/': 0.30; "we're": 0.30; 'driven': 0.33; 'raised': 0.33; 'traceback': 0.33; 'this?': 0.34; 'that,': 0.34; 'list': 0.34; 'received:google.com': 0.35; 'could': 0.35; 'something': 0.35; 'but': 0.36; 'list,': 0.36; 'possible.': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'expect': 0.37; 'list.': 0.37; 'things': 0.38; 'stuff': 0.38; 'mean': 0.38; 'sure': 0.39; "didn't": 0.39; 'where': 0.40; 'still': 0.40; 'some': 0.40; 'here.': 0.62; 'more': 0.63; 'records': 0.70; 'jul': 0.72; 'chrisa': 0.84; 'imagine,': 0.84; "it'd": 0.84; 'pardon': 0.84; 'to:none': 0.91; 'from.': 0.93 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=T/kyan1YRWK0kAEMBUmORIz4F1EaZrl/aO97+sDX5GY=; b=B7W6e44WJqrccThoRQ6kfmG5wHEODQv5O7N0mhh0YnbAPI6Tb3Ujscw6cJvp6eLJvM uTQ2k2bK/c2SC57+FZFUATIYTyv0cvLnms8qYVqyPzPL0lFHgNt8o08tLeiZaVfPPJcB zPlIi5FbvqoOiw5qAHV70xZZqe1Qz9ftx7rjGPNUXJXg+3VRook6Ciq5mZUAAWYvNmGI FsJfFJcFk7f6+vj5OSDyKCLokA+cYHPxHUw9zNiPPNwRf6iQl9FTYUBYDR6UAA1sHyYn qSj/bPmYz4QxoXncqUdO5h2HIH1lqnGkclyWbUi2b6sAM0ARFs7zN5FsDeGspcY6XKew Kojw== MIME-Version: 1.0 X-Received: by 10.50.60.100 with SMTP id g4mr9689361igr.41.1437131119761; Fri, 17 Jul 2015 04:05:19 -0700 (PDT) In-Reply-To: <55A8DD75.5000403@rece.vub.ac.be> References: <87fv4r1fre.fsf@jester.gateway.sonic.net> <87bnff1eks.fsf@jester.gateway.sonic.net> <87d1zunctp.fsf@elektro.pacujo.net> <87k2u2eu67.fsf@elektro.pacujo.net> <55A51662.4090007@rece.vub.ac.be> <55A75DE0.1070101@rece.vub.ac.be> <55A7B80B.6090905@rece.vub.ac.be> <55A7C094.7060604@rece.vub.ac.be> <55A8DD75.5000403@rece.vub.ac.be> Date: Fri, 17 Jul 2015 21:05:19 +1000 Subject: Re: Possibly Pythonic Tail Call Optimization (TCO/TRE) 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.20+ 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: 27 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1437131122 news.xs4all.nl 2823 [2001:888:2000:d::a6]:43753 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:94004 On Fri, Jul 17, 2015 at 8:48 PM, Antoon Pardon wrote: > Just wondering, are traceback records of generators available? They are > if an exception is raised in the generator itself, but what if an exception > is raised in the loop that is driven by a generator. They don't appear in > the standard stack trace. Not sure what you mean here. Something like this? def gen(): yield stuff yield more stuff for stuff in gen(): bomb with exception The error didn't happen in the generator, so I wouldn't expect to see it in the traceback. There's still room for the cause of an error to not be in the traceback; imagine, for instance, a function that populates a concrete list, and then you iterate over the list. If that function sticks a None into the list and the subsequent processing is expecting all strings, that's going to bomb, but then you have to figure out where the None came from. If the traceback could include that, it'd be great, but some things aren't possible. Doesn't mean we're happy to sacrifice other functionality. ChrisA