0

Possible Duplicate:
What is the purpose of the colon before a block in Python?

I've just done a bit of research on Python and am intrigued by the language construct.

if expression:
    print 1
    ...
    print 2

I'm surprised and impressed that python group commands for a statement by indentation. It seems as though the designers said we don't need/want extra characters such as { ... } in C and End If in VB.

But why do statements end with : (colon)? Seems superfluous given the lack of an end delimiters.

Community
  • 1
  • 1
Tim Murphy
  • 4,892
  • 4
  • 40
  • 48

0 Answers0