[docs] [issue12188] PEP 7, C style: add ++ policy and explanation

Terry J. Reedy report at bugs.python.org
Thu May 26 20:19:32 CEST 2011

New submission from Terry J. Reedy <tjreedy at udel.edu>:

In response to a discussion of a patch removing 'useless' post-increments, (which issue has apparently come up before)
Guido posted
"> 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."

A condensed version of the above added to PEP 7 would help new developers see the usage as local idiom rather than style bug.

assignee: docs at python
components: Documentation
messages: 136991
nosy: docs at python, terry.reedy
priority: normal
severity: normal
status: open
title: PEP 7, C style: add ++ policy and explanation

Python tracker <report at bugs.python.org>

More information about the docs mailing list