[Chicago] The Chipy network

skip at pobox.com skip at pobox.com
Fri Oct 21 16:52:06 CEST 2011

    >> The availability of this support is pretty much irrelevant to a high
    >> level, cross-platform language like Python.

    Martin> Totally.  If you're coming from a C-like language, feeling the
    Martin> lack of ++ is at most a symptom of the deeper need to stop
    Martin> thinking about things one byte at a time!  <wink... but srsly,
    Martin> too, been there>

Sorry, I haven't been following this thread based on its subject (nudge,
nudge, wink, wink), but eventually stumbled on a couple messages.

I believe Guido decided to leave increment and decrement operators out of
Python largely because their behavior is confusing enough in the C world.
In a complex expression where one variable is referenced multiple times,
sometimes with an increment or decrement operator, sometimes without, it's
not immediately obvious when that modification will take place w.r.t. to all
the variable references in the expression.

Later on, when discussing what eventually became the augmented assignment
operators (+=, //=, etc) I think syntactic considerations may have also been
a consideration lobbying against the addition of ++ or -- operators.  In any
case, something like

    i += 1

avoids the semantic confusion of increment/decrement operators and is as
efficient at runtime (one load and one store of the variable).


More information about the Chicago mailing list