Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #19065
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | Thomas Heller <theller@ctypes.org> |
| Newsgroups | comp.lang.python |
| Subject | Re: Finding x is 1, and x is 'foo' comparisons in a code base |
| Date | Tue, 17 Jan 2012 19:47:53 +0100 |
| Lines | 15 |
| Message-ID | <9nlu2pFb0U1@mid.individual.net> (permalink) |
| References | <6e061ae1-bb46-43bd-ad97-0aff30cc374e@m20g2000vbf.googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | individual.net fYp5GdL00zv8D4GqIlZSZweKu6Dv/LKXkd9Ha55f0fM8vqfSk= |
| Cancel-Lock | sha1:e/UNf8oDar5EKeQqJO+X3Gm2vU4= |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 |
| In-Reply-To | <6e061ae1-bb46-43bd-ad97-0aff30cc374e@m20g2000vbf.googlegroups.com> |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:19065 |
Show key headers only | View raw
Am 17.01.2012 18:10, schrieb Alex Willmer: > Hello, > > I'm looking for a way to find the occurrences of x is y comparisons in > an existing code base. Except for a few special cases (e.g. x is [not] > None) they're a usually mistakes, the correct test being x == y. > However they happen to work most of the time on CPython (e.g. when y > is a small integer or string) so they slip into production code > unnoticed. > > PyLint and PyFlakes don't check this AFAICT. Any suggestions for such > a tool, or a pointer how to add the check to an existing tool would be > most welcome. Pychecker contains a check for this mistake.
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Finding x is 1, and x is 'foo' comparisons in a code base Alex Willmer <alex@moreati.org.uk> - 2012-01-17 09:10 -0800 Re: Finding x is 1, and x is 'foo' comparisons in a code base MRAB <python@mrabarnett.plus.com> - 2012-01-17 18:39 +0000 Re: Finding x is 1, and x is 'foo' comparisons in a code base Thomas Heller <theller@ctypes.org> - 2012-01-17 19:47 +0100
csiph-web