Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.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; 'main()': 0.05; 'exception,': 0.07; 'nasty': 0.07; '__name__': 0.09; 'finally:': 0.09; "'__main__':": 0.16; 'better?': 0.16; 'called,': 0.16; 'rachel': 0.16; 'subject:case': 0.16; 'cc:addr:python-list': 0.16; "wouldn't": 0.17; 'wrote:': 0.18; 'cc:no real name:2**0': 0.21; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; 'cc:2**0': 0.26; 'subject:skip:a 10': 0.29; 'cc:addr:python.org': 0.29; 'pm,': 0.29; '(and': 0.30; 'message-id:@gmail.com': 0.31; "isn't": 0.33; 'header:User-Agent:1': 0.33; 'it?': 0.33; 'try:': 0.34; 'received:209.85.214': 0.36; 'received:10.0.0': 0.37; 'received:google.com': 0.37; 'received:209.85': 0.38; 'some': 0.38; 'received:209': 0.39; 'goodbye': 0.73 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=habBbt1qDK7Vk5oJ14h5ufOj/GtKQ4cd6M87Oh+GUBE=; b=pkwdNpUH7EOjiD+RFlZU5G+HCvx5wDpCXThJ4pnSxx5Kqqfux3epJYFC/uKm1hFFPl 6lWlQlgvpGTtOvddWgIx9L4vSepKy0txMyH72WCaPtsdDuKZq/u5ewpH8rPtIjo1j2W6 hIym3RTjeI3JYd9NgW7ReLGuiKOLK3Kk52N0A= Date: Wed, 15 Feb 2012 15:41:12 +0000 From: Andrea Crotti User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111224 Thunderbird/9.0.1 MIME-Version: 1.0 To: Thomas Rachel Subject: Re: atexit.register in case of errors References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 19 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1329320476 news.xs4all.nl 6933 [2001:888:2000:d::a6]:43641 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:20447 On 02/15/2012 03:18 PM, Thomas Rachel wrote: > > Wouldn't > > if __name__ == '__main__': > try: > main() > finally: > goodbye() > > be even better? Or doesn't it work well together with SystemExit? > > > Thomas Well in that case goodbye is always called, even if I have some other nasty exception, which is not what I want.. (and is exactly what I had with atexit.register). Isn't it?