Georg Brandl wrote: > On 06/07/11 05:20, brett.cannon wrote: >> http://hg.python.org/cpython/rev/fc282e375703 >> changeset: 70695:fc282e375703 >> user: Brett Cannon <br...@python.org> >> date: Mon Jun 06 20:20:36 2011 -0700 >> summary: >> Remove some extraneous parentheses and swap the comparison order to >> prevent accidental assignment. >> >> Silences a warning from LLVM/clang 2.9. > > Swapping the comparison order here seems a bit inconsistent to me. There are > lots of others around (e.g. "len == 0" in the patch context below). Why is > this one so special? > > I think that another developer even got told off once for these kinds of > comparisons. > > I hope the Clang warning is only about the parentheses.
I agree with Georg: "if ('u' == typecode)" is not well readable, since you usually put the variable part on the left and the constant part on the right of an equal comparison. If clang warns about this, clang needs to be fixed, not our C code :-) > Georg > >> files: >> Modules/arraymodule.c | 2 +- >> 1 files changed, 1 insertions(+), 1 deletions(-) >> >> >> diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c >> --- a/Modules/arraymodule.c >> +++ b/Modules/arraymodule.c >> @@ -2091,7 +2091,7 @@ >> if (len == 0) { >> return PyUnicode_FromFormat("array('%c')", (int)typecode); >> } >> - if ((typecode == 'u')) >> + if ('u' == typecode) >> v = array_tounicode(a, NULL); >> else >> v = array_tolist(a, NULL); > > > > _______________________________________________ > Python-Dev mailing list > Python-Dev@python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > http://mail.python.org/mailman/options/python-dev/mal%40egenix.com -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Jun 07 2011) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ 2011-05-23: Released eGenix mx Base 3.2.0 http://python.egenix.com/ 2011-05-25: Released mxODBC 3.1.1 http://python.egenix.com/ 2011-06-20: EuroPython 2011, Florence, Italy 13 days to go ::: Try our new mxODBC.Connect Python Database Interface for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/ _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com