Re: [Tutor] foreach loops

2006-09-12 Thread Alan Gauld
Does python have foreach loops? I don't see any mention of them in the docs. Am I going to have to use Perl (gasp!) if I want my beloved foreach loop? Its called a for loop in Python... Or is there some extra magic in the Perl version that I'm missing? Alan G.

Re: [Tutor] foreach loops

2006-09-12 Thread Alan Gauld
I was thinking more along the lines of this: A C++ for loop: This is exactly NOT a foreach loop, its a vanilla for loop. #include iostream using std::cout; int main() { for (int i = 0; i 10; i++) { cout i \n; } for i in range(10): print i Alan G.

[Tutor] foreach loops

2006-09-11 Thread Christopher Spears
Does python have foreach loops? I don't see any mention of them in the docs. Am I going to have to use Perl (gasp!) if I want my beloved foreach loop? -Chris ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] foreach loops

2006-09-11 Thread Danny Yoo
Does python have foreach loops? I don't see any mention of them in the docs. Am I going to have to use Perl (gasp!) if I want my beloved foreach loop? Can you show an example of a Perl foreach loop? Perhaps someone can help translate it into idiomatic Python. Good luck!

Re: [Tutor] foreach loops

2006-09-11 Thread Luke Paireepinart
Danny Yoo wrote: Does python have foreach loops? I don't see any mention of them in the docs. Am I going to have to use Perl (gasp!) if I want my beloved foreach loop? Can you show an example of a Perl foreach loop? Perhaps someone can help translate it into idiomatic Python.

Re: [Tutor] foreach loops

2006-09-11 Thread Luke Paireepinart
Christopher Spears wrote: Hmmm...Perl is probably a bad example. My apologies. I was thinking more along the lines of this: A C++ for loop: #include iostream using std::cout; int main() { for (int i = 0; i 10; i++) { cout i \n; }

Re: [Tutor] foreach loops

2006-09-11 Thread Jordan Greenberg
Christopher Spears wrote: Hmmm...Perl is probably a bad example. My apologies. I was thinking more along the lines of this: A C++ for loop: #include iostream using std::cout; int main() { for (int i = 0; i 10; i++) { cout i \n; }