Op 18/12/2025 om 5:02 schreef c186282:
  Oh, I usually write "i=i+2". It's a bit more
  clear and becomes the same code anyway.
I'm going to disagree here. In my opinion i += 2 is more clear. It avoids repeating the i, which makes it more immediately clear that the operation only involves variable i and nothing else.
+=   is more a 'C' thing.
It's perfectly idiomatic Python too. Using += is nothing like falling back to C-style constructs.

--
"Programming today is a race between software engineers striving to build bigger
and better idiot-proof programs, and the Universe trying to produce bigger and
better idiots. So far, the Universe is winning."
        -- Douglas Adams


--
https://mail.python.org/mailman3//lists/python-list.python.org

Reply via email to