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-May/111684.html below:

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

[Python-Dev] cpython: Avoid useless "++" at the end of functions [Python-Dev] cpython: Avoid useless "++" at the end of functionsBenjamin Peterson benjamin at python.org
Thu May 26 20:26:43 CEST 2011
2011/5/26 Terry Reedy <tjreedy at udel.edu>:
> On 5/26/2011 2:08 PM, Guido van Rossum wrote:
>
>> Sorry to butt in here, but I agree with Eric that it was better
>> before. There is a common idiom, *pointer++ =<something>, and
>> whenever you see that you know that you are appending something to an
>> output buffer. Perhaps the most important idea here is that this
>> maintains the *invariant* "pointer points just after the last thing in
>> the buffer". Always maintaining the invariant is better than trying to
>> micro-optimize things so as to avoid updating dead values. The
>> compiler is better at that.
>
> This explanation makes sense (more than Eric's version of perhaps the same
> thing ;-).
>
> http://bugs.python.org/issue12188
> "A condensed version of the above added to PEP 7 would help new developers
> see the usage as local idiom rather than style bug."

I think a more general formulation would be: "Idiomatic code is more
important than making static analyzers happy."



-- 
Regards,
Benjamin
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