newbie question
Dan Perl
danperl at rogers.com
Wed Feb 9 23:12:20 EST 2005
"Cameron Laird" <claird at lairds.us> wrote in message
news:feuqd2-bqv.ln1 at lairds.us...
> In article <seudnRY79e_AXJffRVn-pg at rogers.com>,
> Dan Perl <danperl at mail-me.com> wrote:
> .
> .
> .
>>has the conciseness of the C statement. The pre- and post-increment
>>and -decrement in C/C++/Java are very powerful and I miss them in python.
>
> Me, too.
>
> Which is, I suspect, evidence for the incompleteness of our Pythonhood.
> As Peter Hansen already hinted in this thread, an appetite for the
> increment and related operators probably is a symptom that there's an
> opportunity nearby to use an iterator or string method or such. C++
> and Java wish they had it so good.
I can't say that is not part of the reason, but the example in the OP is a
clear illustration of cases where something like an increment/decrement
operator would be very useful. OTOH, I was thinking of saying in my
previous posting that I prefer
for n in range(start, 0, -1):
to
n = start
while (n--)
I think that the first form is more readable, although that may be just me.
I would actually even prefer the 'for' statement in C to the 'while'
statement:
for (n=start; n<=0; n--)
More information about the Python-list
mailing list