using range() in for loops
Georg Brandl
g.brandl-nospam at gmx.net
Wed Apr 5 12:19:05 EDT 2006
Steven D'Aprano wrote:
> On Wed, 05 Apr 2006 16:15:12 +0200, Georg Brandl wrote:
>
>> sushant.sirsikar at gmail.com wrote:
>>> hi John,
>>> Python doesn't provide for loop like C / C++ but using Range() or
>>> Xrange() you can achive all the functionalities of the C for loop.
>>
>> Not quite.
>
> Care to explain what the differences are, or shall we guess?
C's for is much more powerful.
for(a; b; c) { d } translates to
a
while b
d
c
which can't be replaced by a simple
for i in range(...)
Georg
More information about the Python-list
mailing list