[sf-perl] Python indentation grumble

Rich Morin rdm at cfcl.com
Sun Apr 2 17:46:18 PDT 2006


At 2:57 PM -0700 4/2/06, Josh Berkus wrote:
> This is how python *works*, Rich.  One might as well bitch
> about weak variable typing in Perl.

I disagree.  I accept the fact that Python:

  *  uses indentation to indicate block structure

  *  disallows indentation that is ambiguous

However, note that Python allows certain types of indentation
that do not indicate block structure:

  *  Continued statements may be indented as desired,
     as long as they are to the right of the initial line.

  *  Comments can be indented as desired.

The guiding principle appears to be

  "Allow arbitrary indentation, as long as it
   doesn't get in the way of block structure."

If this is true, disallowing an arbitrary first-level indent
is simply a mistake, and one which (like allowing tabs as
indentation) YAML does not make.

But then, YAML had the chance to look at Python's mistakes,
avoid them, and make its own (:-).

-r


P.S.  GvR will be at the ACCU meeting this Wednesday:

> When:      Wednesday, April 5, 2006
> Topic:     A Look At Python's Future
> Speaker:   Guido van Rossum
> Time:      7:00pm
> Where:     eBay Town Hall (next to PayPal/eBay)
>               2161 North First St
>               San Jose, CA 95131
> Map:       <http://tinyurl.com/cdg5u/>
> Cost:      Free
> More Info: <http://www.accu-usa.org>
>
> Guido van Rossum is the creator of Python, one of the
> major free scripting languages. He created Python in
> the early 1990s at CWI in Amsterdam, and is still
> actively involved in the development of the language.
>
> In 1995 he moved to the US; first to work for CNRI in
> Reston, VA as a researcher, then for Zope Corporation
> as Director of PythonLabs, then, after a move to the
> SF bay area, for Elemental Security, and then, since
> December 2005, Google.
>
> His home on the web is <http://www.python.org/~guido/>.

-- 
http://www.cfcl.com/rdm            Rich Morin
http://www.cfcl.com/rdm/resume     rdm at cfcl.com
http://www.cfcl.com/rdm/weblog     +1 650-873-7841

Technical editing and writing, programming, and web development


More information about the SanFrancisco-pm mailing list