Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!news.albasani.net!newsfeed.x-privat.org!news2.euro.net!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.025 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'exception': 0.03; 'afterwards.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'wrote:': 0.17; 'feb': 0.19; "i'd": 0.22; 'errors': 0.23; 'raise': 0.24; 'header:In-Reply-To:1': 0.25; '(as': 0.27; 'then.': 0.27; 'message-id:@mail.gmail.com': 0.27; 'received:209.85.212': 0.28; "d'aprano": 0.29; 'steven': 0.29; 'point': 0.31; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'especially': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'easier': 0.38; 'possible.': 0.38; 'to:addr:python.org': 0.39; '2013': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=f0+scKe8bl8u94bBn431MfnIxFih7S2erYcGBSC7v/U=; b=ZXAVKxhBWEmUYgYP6Sy2bAOI97Taxi0VW20QL5SIc/fsLgO0fHZ6Uk4EqwpRdSNfiL D4KHB9p6VoJOB3WLN9E2+APzQ3AJ+xlyPJpuYAj3jYnki98eDA5FAXss3riesXKRHejL tKSatP1Y0xjgVzKBcvX8isuPwlGbbGPg6fN2dkD2uoMhyyFpVkIad26P5DnU1Oddc3Lx pA0JGzrOXReFDSc9xpuoYaCOAiWCvvNayCzBXMMQViIvtEJ2/GwK8FWBBLJtkVK1PDqL Iih1BKOWnkfVr0c8/o/q0/M4hQ8dl7L2IPNLDS2EO4NojK9nQ2VvQfP9kkRm9P+uwcLg e6fQ== MIME-Version: 1.0 X-Received: by 10.220.219.77 with SMTP id ht13mr25427485vcb.66.1360041619858; Mon, 04 Feb 2013 21:20:19 -0800 (PST) In-Reply-To: <51109001$0$21856$c3e8da3$76491128@news.astraweb.com> References: <5110415c$0$29986$c3e8da3$5496439d@news.astraweb.com> <51109001$0$21856$c3e8da3$76491128@news.astraweb.com> Date: Tue, 5 Feb 2013 16:20:19 +1100 Subject: Re: LBYL vs EAFP From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 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: 10 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1360041622 news.xs4all.nl 6881 [2001:888:2000:d::a6]:42021 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:38163 On Tue, Feb 5, 2013 at 3:52 PM, Steven D'Aprano wrote: > There's also the principle that it is best to raise an exception as early > as possible. It's easier to track down errors at the point they are > introduced than long afterwards. Yes, definitely, especially (as was mentioned) if you're working with callbacks. But I'd use isinstance then. ChrisA