why no ++?

Grant Griffin not.this at seebelow.org
Fri Aug 3 17:14:03 EDT 2001


In article <3B6AA8A1.4000907 at herts.ac.uk>, Mark says...
...
>I especially agree, makes me think a bit about how I use things too. Who 
>knows before you know it I might actually write something I wasn't 
>ashamed to show ;). Thats why I intend to carry on picking everyones 
>brain on here.

Don't hesitate.  But rember: you can pick your friends, and you can pick your
friends' brains, but you can't pick your friends' nose.

I'm not sure if anyone has explained the philosophical basis of "why no ++". 
It's rooted in Tim Peters' maxim:

   There should be on--and preferably only one--obvious way to do things.

One problem with "++" in C is that there are prefix and postfix forms; true,
both forms are handy and useful, but they do cause confusion.  (Let's see a show
of hands: who has never once used one when he should have used the other?)

BTW, I once thought that the maxim above was why Python 1.5.2 (which was current
at the time) didn't have any "augmented assignment" operators (+=, -=, etc.) 
However, I have since learned that they just hadn't been implemented yet.  I
think one of the selling points of these things to Guido (Tim's maxim above
notwithstanding) was that they offer some real "value added" by allowing
operations to be done "in place" rather than via a copy.  (Still, most of us
just use them to increment integers<wink>.)

you-can-lead-a-horse-to-water-but-if-you-want-to-make-him
   -drink-you-gotta-wait-patiently-until-he-comes-up-with
   -an-excuse-to-be-thirsty-ly y'rs,

=g2

_____________________________________________________________________

Grant R. Griffin                                       g2 at dspguru.com
Publisher of dspGuru                           http://www.dspguru.com
Iowegian International Corporation            http://www.iowegian.com




More information about the Python-list mailing list