newbie question
Dan Perl
danperl at rogers.com
Wed Feb 9 21:05:14 EST 2005
<doodle4 at gmail.com> wrote in message
news:1107990182.516041.120410 at o13g2000cwo.googlegroups.com...
> Hello All,
> What is the python equivalent of the following statement?
>
> while (n--)
Like other posters said, you should give more details with your question.
What do you mean by equivalent? The following is *functionally* equivalent:
for n in range(start, 0, -1):
Of course, there is always:
while n:
...
n -= 1
But unfortunately, no, I don't think there is an equivalent in python that
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.
More information about the Python-list
mailing list