Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #18513
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!de-l.enfer-du-nord.net!feeder1.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 | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'python.': 0.04; 'c/c++': 0.05; 'subject:code': 0.07; 'python': 0.08; 'comparisons': 0.09; 'undefined': 0.09; 'variables,': 0.09; 'subject:python': 0.10; 'exception': 0.12; 'etc?': 0.16; 'simulate': 0.16; 'subject:analysis': 0.16; 'subject:questions': 0.16; 'cc:addr :python-list': 0.16; 'wed,': 0.17; 'wrote:': 0.18; 'slightly': 0.19; 'jan': 0.19; 'cc:no real name:2**0': 0.20; 'cheers,': 0.20; 'programming': 0.21; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; 'cc:2**0': 0.24; 'received:74.125.82.174': 0.24; 'scale': 0.25; 'code': 0.25; 'module': 0.26; "i'm": 0.26; 'code,': 0.27; 'variable': 0.28; 'compare': 0.28; 'bugs': 0.28; 'coding': 0.28; 'message-id:@mail.gmail.com': 0.28; 'cc:addr:python.org': 0.29; 'error': 0.29; 'pm,': 0.29; 'checking.': 0.30; 'types.': 0.30; "i've": 0.31; 'cases': 0.32; 'there': 0.33; 'rule': 0.34; 'ordered': 0.34; 'received:74.125.82': 0.35; 'test': 0.35; 'comparing': 0.37; 'variables': 0.37; 'two': 0.37; 'but': 0.37; 'hello,': 0.37; 'received:74.125': 0.37; 'received:google.com': 0.37; 'could': 0.37; 'using': 0.38; 'allows': 0.38; 'flexibility': 0.39; 'relatively': 0.39; 'should': 0.39; 'recommended': 0.39; "it's": 0.40; 'type': 0.61; 'types': 0.61; 'love': 0.62; 'subject: / ': 0.63; 'below': 0.63; 'life': 0.64; '2012': 0.67; 'analysis': 0.77; 'night': 0.82; 'lucas': 0.93 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=4c6Ns+sva2soZ5c78W7iNJ2PqpbwggZRIq4tjAe+SRY=; b=n/ZSTxY9jfBp55elx49Ds+6tEzDrhwE5KgSFX97aQIpgpXdLDacXJj/cGQEdXHaY0D 3ESeANbvBTZU15dKKV3L3PbYn/lnwk1N+qdQNXkWpWpNxB59W92fq6JTpLWOb3G+jUei rIca581+IfUU/05z/a+1Iu513syh1bBCVN1JY= |
| MIME-Version | 1.0 |
| In-Reply-To | <CAH0oNN+cT4WqM+M+Ne9eOfFL4y71sG84XqYDo+NAkLp-w1kVjw@mail.gmail.com> |
| References | <CAH0oNN+cT4WqM+M+Ne9eOfFL4y71sG84XqYDo+NAkLp-w1kVjw@mail.gmail.com> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Wed, 4 Jan 2012 13:34:23 -0700 |
| Subject | Re: Typed python comparison / code analysis questions |
| To | Lucas Vickers <lucasvickers@gmail.com> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| 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 <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.4425.1325709295.27778.python-list@python.org> (permalink) |
| Lines | 36 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1325709295 news.xs4all.nl 6904 [2001:888:2000:d::a6]:55422 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:18513 |
Show key headers only | View raw
On Wed, Jan 4, 2012 at 1:09 PM, Lucas Vickers <lucasvickers@gmail.com> wrote: > Hello, > > I'm relatively new to Python. I come from C/C++ so I love the flexibility > but I am slightly irked by the lack of compilation time checking. > > I've got two questions > 1) Are there any tools that do an analysis of code and attempt to catch > potential issues such as undefined variables, etc? I use xdebug in php for > this purpose and it's a life saver. Currently for Python I use module test > cases and simulate situations but this doesn't catch everything and on a > larger scale of development becomes difficult. Yes, try pylint, pychecker, or pyflakes. > 2) Is there a way to error when comparing variables of different types? I > was up late last night coding and caused a few bugs with the below code, > which turns out to compare a type<str> to a type<int>. I know good > programming I should know what my variable types are, but it would be even > better if I could always abide by a rule of using <_ (or something) which > would spit an exception when comparing non-equal types/instances. This is a well-known wart in Python 2. The recommended solution would be to upgrade to Python 3, which no longer allows ordered comparisons between unrelated built-in types. Cheers, Ian
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Typed python comparison / code analysis questions Ian Kelly <ian.g.kelly@gmail.com> - 2012-01-04 13:34 -0700
csiph-web