Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: Python Error message Date: Fri, 5 Aug 2016 05:53:29 +1000 Lines: 17 Message-ID: References: <710599b6-b8c3-4f5a-a3dd-48757b816a44@googlegroups.com> <57a36593$0$1590$c3e8da3$5496439d@news.astraweb.com> <23e36680-195e-b840-599e-e225cdc2cee8@mrabarnett.plus.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de iDQMh5OPWdYFBCirH6gDEAOrFYVD+15vKFfhc9nv4zsg== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'handler': 0.04; 'subject:Python': 0.05; 'interpreted': 0.07; 'subject:Error': 0.07; 'wrapper': 0.07; 'cc:addr:python-list': 0.09; 'executes': 0.09; 'server:': 0.09; 'statements': 0.09; 'throws': 0.09; 'python': 0.10; 'exception': 0.13; 'interpreter': 0.15; '2016': 0.16; 'bubbles': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'reedy': 0.16; 'worst': 0.16; 'wrote:': 0.16; 'example.': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'aug': 0.20; 'do.': 0.22; 'exceptions': 0.22; 'function,': 0.22; 'latter': 0.22; 'am,': 0.23; 'code.': 0.23; 'header:In-Reply-To:1': 0.24; 'example': 0.26; 'fri,': 0.27; 'message-id:@mail.gmail.com': 0.27; '(it': 0.29; 'code': 0.30; 'writes': 0.30; 'another': 0.32; 'common': 0.33; 'idle': 0.33; 'raised': 0.33; 'that,': 0.34; 'received:google.com': 0.35; 'but': 0.36; 'should': 0.36; 'subject:: ': 0.37; 'wrong': 0.38; 'log': 0.38; 'back': 0.62; '500': 0.63; '5:36': 0.84; 'chrisa': 0.84; 'isolate': 0.84; 'to:none': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:cc; bh=5ApNwHnU92jYc7eVrHUx2ID5ZD0pqPLTsZgRmIbkHsg=; b=E9QSqIVNypq7bXgK7HJGrrnjbe/rPDG4uIFCM7uyo+MeeD2fFdK5mc3lbXuGLZRCwU 81cxouz8ZymSWoEOTBZZNgHygtHko8jzCEGq3dLZA2No1FmQ9J37OuTapeber5PtDLCT 5letgrzzOgyScrQX7PyoVIQ5ZqklSolOuUYNdlt3mE1KRu9XiOTFQVDmIxylIi9M3Jh7 03zKasHvDfF7aMcrA4aDA1ELb5jl9uxVQcIzSrTNJ5kVlZb9OJU4Pe2D3DlbBxikp3o3 dwvQEwA6fGGoZ6Bw8/NUeZR7ktGSv+4eHaIqfpWFg5PgDdXaRI9Dy3JOKjrvvt3ukXrq TeNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:cc; bh=5ApNwHnU92jYc7eVrHUx2ID5ZD0pqPLTsZgRmIbkHsg=; b=UYA9YFneXWGym29CVaKfuEXmmCciNRpVSral+MMnyywib24wir27/6+YSsNB6LOkRp qY17oPrn5Ub1lo9V42lAdKsSljcKzMXTIUSZzYX03Z1ssc9HOWQeumLu+nBo8AUNwZMz 0YO1N9/H0nmGVCiQNzbS54jWeP8OIlhTyGkF/3dRakWK7pvnm1uc81B5A+p6hMslsRE0 4xwYEt3VzZdR5bGECM0I3b+Q9u/gvGWW0UvIC/BybTALqEvlBzHGruNUG0GdVjw/8jvS ss7gMQx+5rgc8vOYcyG3F28559yRP+e5Ijy2/UMKeTUKXKkZBAL+D9uxIagcXJDWz/Nz 8TDw== X-Gm-Message-State: AEkoouua48zwANXofV6ww1AG+/V9nbVX1bEsld771Z2wchxUY6ZC6kLoksIIksJvJQyYXA6GrqgRzXKW8i5/+g== X-Received: by 10.194.221.232 with SMTP id qh8mr68014714wjc.117.1470340410193; Thu, 04 Aug 2016 12:53:30 -0700 (PDT) In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <710599b6-b8c3-4f5a-a3dd-48757b816a44@googlegroups.com> <57a36593$0$1590$c3e8da3$5496439d@news.astraweb.com> <23e36680-195e-b840-599e-e225cdc2cee8@mrabarnett.plus.com> Xref: csiph.com comp.lang.python:112350 On Fri, Aug 5, 2016 at 5:36 AM, Terry Reedy wrote: > An example of the latter is when one writes code in Python to execute > 'other' code. (IDLE is one example. It both executes user statements and > evals user expressions.) One needs "except BaseException:" to isolate the > interpreter from exceptions raised in the interpreted code. (It would be > wrong for IDLE to stop because a user submitted code that raises, whether > intentionally or accidentally) A 'raise' that throws the exception into the > interpreter is likely the worst thing to do. This is a classic example of a "boundary location". Another extremely common example is a web server: if an exception bubbles out of a request handler function, the outer wrapper code should catch that, log it, and send a 500 back to the client. But none of this is what the OP is doing. ChrisA