[PATCH 3 of 8] url: remove is-comparisons with non-singletons

Martin Geisler mg at aragost.com
Wed Nov 17 02:05:19 CST 2010


Mads Kiilerich <mads at kiilerich.com> writes:

> I won't claim to be a Python expert, but I don't think the check-code
> check proposed by Matt is a good idea. It can't be made reliable -
> unless we say that all uses of 'is' has to be white-listed somehow.

I propose that we just blacklist using of 'is' with string and numeric
literals. That would be something like this:

  (r''' is\s+(not\s+)?["'0-9]''', "object comparison with literal"),

This does not catch the

  if err.errno is errno.ENOENT:

line, but I can live with that.

-- 
Martin Geisler

aragost Trifork
Professional Mercurial support
http://mercurial.aragost.com/kick-start/


More information about the Mercurial-devel mailing list