Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #20447

Re: atexit.register in case of errors

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 <andrea.crotti.0@gmail.com>
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 <andrea.crotti.0@gmail.com>
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 <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de>
Subject Re: atexit.register in case of errors
References <mailman.5827.1329311531.27778.python-list@python.org> <jhgc7t$b2m$1@speranza.aioe.org> <mailman.5829.1329313984.27778.python-list@python.org> <jhgicb$v3k$1@r03.glglgl.gl>
In-Reply-To <jhgicb$v3k$1@r03.glglgl.gl>
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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.5833.1329320476.27778.python-list@python.org> (permalink)
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

Show key headers only | View raw


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?

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

atexit.register in case of errors Andrea Crotti <andrea.crotti.0@gmail.com> - 2012-02-15 13:12 +0000
  Re: atexit.register in case of errors Mel Wilson <mwilson@the-wire.com> - 2012-02-15 08:33 -0500
    Re: atexit.register in case of errors Devin Jeanpierre <jeanpierreda@gmail.com> - 2012-02-15 08:52 -0500
      Re: atexit.register in case of errors Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2012-02-15 16:18 +0100
        Re: atexit.register in case of errors Andrea Crotti <andrea.crotti.0@gmail.com> - 2012-02-15 15:41 +0000
    Re: atexit.register in case of errors Andrea Crotti <andrea.crotti.0@gmail.com> - 2012-02-15 14:35 +0000
  Re: atexit.register in case of errors Miki Tebeka <miki.tebeka@gmail.com> - 2012-02-15 10:40 -0800
  Re: atexit.register in case of errors Miki Tebeka <miki.tebeka@gmail.com> - 2012-02-15 10:40 -0800

csiph-web