Skip to main content
edited tags
Link
kratenko
  • 7.6k
  • 5
  • 39
  • 63
formatting
Source Link
Brian Dukes
  • 156.8k
  • 25
  • 152
  • 176

I'm about 2 weeks deep in my study of Python as an introductory language. I've hit a point in Zed's "Learn Python the Hard Way" where he suggests:

Use a while-loop only to loop forever, and that means probably never.  This only applies
to Python, other languages are different.

Use a while-loop only to loop forever, and that means probably never. This only applies to Python, other languages are different.

I've googled all over this, referenced everything I can, but I can't find any reason in the world why this would be a convention in Python. What makes it different?

When I gave up programming 10 years ago, I was working in VB and would regularly be told to get rid of my For loops and use While loops instead. I was a hack (as I am today, though I wrote a LOT of code back then), so I just did what I was told without questioning it. Well, now I'm questioning it. Is this a speed issue? Is it just to avoid escape-less infinites?

I'm about 2 weeks deep in my study of Python as an introductory language. I've hit a point in Zed's "Learn Python the Hard Way" where he suggests:

Use a while-loop only to loop forever, and that means probably never.  This only applies
to Python, other languages are different.

I've googled all over this, referenced everything I can, but I can't find any reason in the world why this would be a convention in Python. What makes it different?

When I gave up programming 10 years ago, I was working in VB and would regularly be told to get rid of my For loops and use While loops instead. I was a hack (as I am today, though I wrote a LOT of code back then), so I just did what I was told without questioning it. Well, now I'm questioning it. Is this a speed issue? Is it just to avoid escape-less infinites?

I'm about 2 weeks deep in my study of Python as an introductory language. I've hit a point in Zed's "Learn Python the Hard Way" where he suggests:

Use a while-loop only to loop forever, and that means probably never. This only applies to Python, other languages are different.

I've googled all over this, referenced everything I can, but I can't find any reason in the world why this would be a convention in Python. What makes it different?

When I gave up programming 10 years ago, I was working in VB and would regularly be told to get rid of my For loops and use While loops instead. I was a hack (as I am today, though I wrote a LOT of code back then), so I just did what I was told without questioning it. Well, now I'm questioning it. Is this a speed issue? Is it just to avoid escape-less infinites?

Source Link
Random_Person
  • 445
  • 2
  • 7
  • 11

Why avoid while loops?

I'm about 2 weeks deep in my study of Python as an introductory language. I've hit a point in Zed's "Learn Python the Hard Way" where he suggests:

Use a while-loop only to loop forever, and that means probably never.  This only applies
to Python, other languages are different.

I've googled all over this, referenced everything I can, but I can't find any reason in the world why this would be a convention in Python. What makes it different?

When I gave up programming 10 years ago, I was working in VB and would regularly be told to get rid of my For loops and use While loops instead. I was a hack (as I am today, though I wrote a LOT of code back then), so I just did what I was told without questioning it. Well, now I'm questioning it. Is this a speed issue? Is it just to avoid escape-less infinites?