Python Forum
It seems like the overall Python syntax would be error prone
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
It seems like the overall Python syntax would be error prone
#1
I just started reading an intro to Python piece. It shows simple examples of several statements (def, for, while). I'm just getting started, but it looks like the Python compiler (interpreter?) depends on the indentation of the statements to define what is or is not part of a procedure. It looks like there are no End statements.

Is this not error prone? Does it matter how much a statement is indented?

It seems odd to me that spaces have a role in syntax other than in separating tokens.

I would appreciate someone helping me understand why

for i in range(10):
   statement
   statement
   statement
Is as good (clear, readable) as something like

for i in range(10):
   statement
   statement
   statement
end i
And, of course, it gets worse with nested structures

Thanks
Reply


Messages In This Thread
It seems like the overall Python syntax would be error prone - by CynthiaMoore - Apr-01-2020, 08:04 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020