[Tutor] what i miss is a C style for loop

James Clare jrclare@lycos.com
Tue Oct 22 08:15:32 2002


variable++ would be better than variable = variable + 1
Python dosen't have that function does it?
Is there a different short hand way to do variable = variable + 1? 
--

On Tue, 22 Oct 2002 22:14:08  
 Thomi Richards wrote:
>i don't have any concrete examples... I thought "what i need here is a C
>style loop... trouble is, i can't remember where it was.... ahh well...
>
>probably something like:
>
>for i in range(10):
>	do_something_with(i);
>	i+=1;
>
>
>etc...
>
>On Tue, 22 Oct 2002 01:18:47 +0200 Thus said Magnus Lycka
><magnus@thinkware.se>:
>
>> At 10:21 2002-10-22 +1300, Thomi Richards wrote:
>> >ahh well, i know that i can do while loops, but it just seemed to me
>> >that for loops were somewhat "neater"....
>> 
>> I'm still curious about what you would want
>> to use the for loops for. Some concrete examples?
>> 
>> It might well be that things you are used to
>> doing with for loops are done completely without
>> loops in Python, or that python for loops or
>> list comprehension solves it even neater...
>> 
>> We have quite a bag of tricks here... (And
>> Python 2.3 adds a little more...)
>> 
>> 
>> -- 
>> Magnus Lyckå, Thinkware AB
>> Älvans väg 99, SE-907 50 UMEÅ
>> tel: 070-582 80 65, fax: 070-612 80 65
>> http://www.thinkware.se/  mailto:magnus@thinkware.se
>> 
>> 
>> _______________________________________________
>> Tutor maillist  -  Tutor@python.org
>> http://mail.python.org/mailman/listinfo/tutor
>
>
>-- 
>This message was brought to you by one bored guy, with nothing better to
>do,
>And the letter Q.
>Thomi Richards,
>thomi@imail.net.nz
>
>_______________________________________________
>Tutor maillist  -  Tutor@python.org
>http://mail.python.org/mailman/listinfo/tutor
>


____________________________________________________________
Get 250 full-color business cards FREE right now!
http://businesscards.lycos.com