Larry Wall's comment on python...

Brian Slesinsky bslesins at
Mon Sep 9 07:42:46 CEST 2002

Rod Stephenson <viking_kiwi at> wrote in message news:<wkr8g7rn4c.fsf at>...
> Slashdot has a list of questions posed to Larry Wall (perl). When
> asked his thoughts on other scripting languages, he makes the
> following observation about python
> "Python is cool to look at small bits of, but I think the "outline"
> syntax breaks down with larger chunks of code. I'm with Aristotle on
> the structure of discourse--a story should have a beginning, and
> middle, and an end. So should blocks"
> I'm not quite sure what he's trying to get at here - I guess that for
> a long heavily indented chunk of code, you could lose track of the
> overall structure, but I don't write code this way.
> Any comments?

He's repeating the standard newbie complaint.  However, I think the
fact that so many people have repeated this for so long is
significant.  Long-term Python programmers tend to forget how weird it
is to some newcomers to end a function or class just by *stopping*. 
It feels abrupt and rather fragile, particularly when you don't have a
firm grasp of the language.  If newbies have complained for this long,
the complaint's not going away, and if we're serious about making
Python easy to pick up it might be good to listen.

I've long thought that Python would be improved by an optional "end"
statement.  Example:

class Foo:

    def bar(self, x):
        # ...

    # (imagine 20 more short methods definitions here)

end Foo
# or "end class Foo", or "end class", or, just "end"

Of course it's unnecessary and should be entirely optional.  Putting
an "end" after every block would certainly be overly verbose and bad
style.  But ending major blocks in a way that's syntax-checkable might
catch the occasional indentation error and/or make error messages
clearer.  The main drawback is another reserved word, but it's one
that's reserved in several other programming languages.

I also think there would be a certain satisfaction in having a proper
ending, even for folks who are entirely comfortable with Python's
indentation.  It's like "Q.E.D." at the end of a proof, or "The End"
at the end of children's book, or signing a message even though the
"From" header line makes it entirely redundant.

- Brian Slesinsky

More information about the Python-list mailing list