Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #19065
| 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 | 2012-01-17 19:47 +0100 |
| Message-ID | <9nlu2pFb0U1@mid.individual.net> (permalink) |
| References | <6e061ae1-bb46-43bd-ad97-0aff30cc374e@m20g2000vbf.googlegroups.com> |
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