A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2011-June/111824.html below:

[Python-Dev] cpython: Remove some extraneous parentheses and swap the comparison order to

[Python-Dev] cpython: Remove some extraneous parentheses and swap the comparison order to [Python-Dev] cpython: Remove some extraneous parentheses and swap the comparison order toEli Bendersky eliben at gmail.com
Tue Jun 7 11:47:13 CEST 2011
>> 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 :-)
>

+1

Placing the constant first in a comparison is a fundamental style
issue. Personally I also don't like doing that, but whatever way is
chosen must be consistent. It's definitely wrong to change this in a
single place. We have PEP-7 for these things!

AFAIK, Clang doesn't produce a warning for this, at least without
special static-analysis warning levels.

Eli
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4