Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.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.058 X-Spam-Evidence: '*H*': 0.88; '*S*': 0.00; 'e.g.,': 0.09; 'pep': 0.09; 'cc:addr:python-list': 0.11; 'from:addr:pobox.com': 0.16; 'from:addr:skip': 0.16; 'nest': 0.16; 'two,': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; 'stack': 0.19; 'cc:addr:python.org': 0.22; 'mon,': 0.24; 'cc:2**0': 0.24; 'source': 0.25; 'subject:/': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'implemented': 0.33; 'could': 0.34; 'received:google.com': 0.35; "didn't": 0.36; "couldn't": 0.39; 'how': 0.40; 'read': 0.60; 'discuss': 0.62; 'school': 0.64; 'great': 0.65; 'finally': 0.65; 'benefit': 0.68; 'difficulty': 0.68; 'walk': 0.74; 'subject:try': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=BclDzxKouID/JXaxirY2yMjGyCWx0b66o7M+ogmQ01M=; b=r+On5ucbQalt5KcbgdI5ZUfT4KFSUty/DyQNp1q5nj4RSNrBDADz78fwkM0/QeBesw +tILOX1+rx5+aLm4EOnBKT2mlRU15mZI7ZtV0FJ6+pQH2yy7Gwd8zoDzKOreieLJsb+g 3VZeR4e3HspSbIctTJCBZB2GNbZ5P1JgORcWBNnxIZoFK7zZ/vI/3S5O6gckYnt8WOxl c+iK9+ieqRQRs7ULEF6dSiSimm2xYhy54PEMOvVenQMrGSC/wQPawoSA+9oDMq0AvH9I /45gdV7TbmO+CmlW3xCXs4Js80+sIzdINWKMBUMO1fAxcfhQIEKLi7PtqPyfKH7aXnzK 19lw== MIME-Version: 1.0 X-Received: by 10.43.62.204 with SMTP id xb12mr31097604icb.51.1402333006705; Mon, 09 Jun 2014 09:56:46 -0700 (PDT) Sender: skip.montanaro@gmail.com In-Reply-To: References: <0a89c96d-de62-42ad-be48-6107ce10d215@googlegroups.com> <53957aa3$0$11095$c3e8da3@news.astraweb.com> <87y4x6s9nx.fsf@elektro.pacujo.net> Date: Mon, 9 Jun 2014 11:56:46 -0500 X-Google-Sender-Auth: 9foETpnIWsCs8NtG5kIfMxVPVMk Subject: Re: try/except/finally From: Skip Montanaro To: Shiyao Ma Content-Type: text/plain; charset=UTF-8 Cc: Python 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: 12 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1402333014 news.xs4all.nl 2904 [2001:888:2000:d::a6]:41373 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:73051 On Mon, Jun 9, 2014 at 11:23 AM, Shiyao Ma wrote: > > It would be great if someone could discuss it from the viewpoint of bytecode. e.g., how the stack is popped, etc. BITD, you couldn't have try/except/finally. You could have try/except or try/finally. You could nest the two, which is what people used to do (back when we had to walk uphill both ways to school in a snowstorm). As I recall, it wasn't implemented from the start because the benefit of having try/except/finally didn't outweigh the difficulty of implementation. Someone finally buckled down and implemented it. To understand it, I think you might have to read the source and PEP 341.