[Python-Dev] [Python-checkins] cpython: Avoid useless "++" at the end of functions

Eric Smith eric at trueblade.com
Thu May 26 16:10:26 CEST 2011


On 5/26/2011 8:32 AM, Victor Stinner wrote:
> Le jeudi 26 mai 2011 à 08:13 -0400, Eric Smith a écrit :
>> If you're ever going to add code at the end of these functions, it's
>> unlikely you'll remember that you need to add these increments back in.
> 
> You don't have to remember. Test the result of the function, it will not
> give the expected output. I don't think that you need fuzzing or a
> complex tool to detect that the new code doesn't behave correctly.
> 
>> It's a bug waiting to happen
> 
> What? It's not a bug. Ading new non-tested code is a bug :-)

True. But assuming all code additions will have 100% branch coverage in
the C code is foolish.

>> I don't see any harm leaving them in.
>> Maybe we should add a comment about why they're done.
> 
> It makes Python faster (!) 

I doubt that.

> and make silent the Clang Static Analyzer :-)

I care less about that than maintainability and future-proofing.


More information about the Python-Dev mailing list