[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Tabs v.s. spaces



>>>>> "Wouter" == Wouter Verhelst <wouter@grep.be> writes:

    Tom> Significant whitespace?  Shudder, that brings back crusty old
    Tom> memories of Fortran.  I have great fondness for fortran because of
    Tom> the wonderful mathematical algorithms in LinPack, but I have no
    Tom> fondness for significant whitespace.
    >>  Please actually try to code something in Python before commenting on
    >> its use of spaces.  It is unlike the times of Fortran: in Fortran
    >> spaces are used to make programs easy to read by machines; in Python
    >> spaces are used to make programs easy to read by human.

    Wouter> then why are they significant?

If you mean literally, the answer is "because the creator of the language
decided that spaces should be significant".

But you really mean "why people want them to be significant", or "why people
will use this language if it is significant", the answer is "because human
beings treat whitespace as significant".  I mean it.  How many C programming
books will warn you against writing code like the following?

  if (x != 0)
      printf("No problem, proceeding");
      myvar /= x;

Human beings think that spaces are significant, and indeed more significant
than braces, as illustrated in the example above.  So Python simply reflects
the significance of whitespace in human being, and use it in exactly that
context: to group statements into blocks.

Regards,
Isaac.



Reply to: