classification
Title: Simple For-Loops
Type: Stage:
Components: Versions:
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: gabrielkfl, pitrou
Priority: normal Keywords:

Created on 2009-06-05 15:54 by gabrielkfl, last changed 2009-06-05 16:15 by pitrou. This issue is now closed.

Messages (2)
msg88950 - (view) Author: Gabriel Koritzky (gabrielkfl) Date: 2009-06-05 15:54
I don't know if something like this has been said before, so if it did
just ignore this.

I have noticed that very few programming languages use simple for loops.
Python itself doesn't have a really simple one. So here's my suggestion:

for ( value ):
# Repeats the code that follows 'value' times if value is an integer. If
it's a string or a list, repeats the code once per character or instance
on 'value'.

for ( iniINC , finalEXC ):
# Repeats the code that follows 'finalEXC - iniINC' times if they're
integers.

for ( variable , iniINC , finalEXC ):
# Assigns iniINC to variable and raises it by one until it reaches
finalEXC (not executing when it does).

#example1
for 70:
	doNothing()

#example2
a = 10
for a:
	doNothing()

#example3
a = 5
for ( a , 10 ):
	doNothing()

#example4
i = 0
for ( i , 10 , 20 ):
	doNothing()
msg88952 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-06-05 16:15
This is not a place for such discussion. Please post on comp.lang.python.
History
Date User Action Args
2009-06-05 16:15:53pitrousetstatus: open -> closed

nosy: + pitrou
messages: + msg88952

resolution: not a bug
2009-06-05 15:54:34gabrielkflcreate