Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.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.045 X-Spam-Evidence: '*H*': 0.91; '*S*': 0.00; 'received:209.85.214.174': 0.13; 'compileall': 0.16; 'crop': 0.16; "\xc2\xa0i'm": 0.16; 'cc:addr:python-list': 0.16; 'wrote:': 0.18; 'cc:no real name:2**0': 0.21; 'header:In-Reply-To:1': 0.22; 'incorrect': 0.23; 'cc:2**0': 0.26; 'module': 0.26; 'up.': 0.26; 'function': 0.27; 'code,': 0.28; "i'm": 0.28; 'message-id:@mail.gmail.com': 0.29; 'cc:addr:python.org': 0.29; 'imported': 0.30; 'skip:\xc2 20': 0.30; 'error': 0.30; 'subject:?': 0.31; 'does': 0.32; 'there': 0.33; 'named': 0.33; 'object': 0.33; 'wondering': 0.34; 'declared': 0.34; 'subject:How': 0.35; 'subject:can': 0.35; 'received:209.85.214': 0.36; 'but': 0.37; 'received:google.com': 0.37; 'using': 0.37; 'received:209.85': 0.38; 'some': 0.38; 'received:209': 0.39; 'john': 0.61; 'simple': 0.61; 'bitten': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=TssHsDduiJRJNhlyMkyvdaswdCLjMfo3PRWJ2ZdjJVw=; b=EmYBvXITpf2ZCz7Dtg+dUstd3f6kOIYqaK6pXtA2S2VrpbT+0gVe4qNY1yx1Fzi6j+ +g+VMiZWsAAdRv2+4gHff+7BXeVMaFu4wiLTDpWUjd2VbVIgsLTK37dEglwVVoyI5YsS SQmp5bADECuNPk/jMvI15nAyn3UN5QRfBMIdc= MIME-Version: 1.0 In-Reply-To: References: Date: Fri, 10 Feb 2012 21:17:02 +0000 Subject: Re: How can I catch misnamed variables? From: Arnaud Delobelle To: John Gordon Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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: 27 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1328908625 news.xs4all.nl 6891 [2001:888:2000:d::a6]:48931 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:20188 On 10 February 2012 21:06, John Gordon wrote: > Recently I was been bitten by some stupid errors in my code, and I'm > wondering if there's a simple way to catch them. > > One error was of the form: > > =C2=A0my_object.some_function() > > .. when I hadn't declared an object named "my_object". > > The other error was similar: > > =C2=A0x =3D my_module.CONSTANT > > .. when I hadn't imported my_module. > > Of course both of these errors were deep inside a long-running function > call, so it took a while for them to crop up. > > Is there an automated way to catch errors like these? =C2=A0I'm using the > compileall module to build my program and it does catch some errors > such as incorrect indentation, but not errors like the above. There's pychecker and pylint --=20 Arnaud