Python as natural language (was Re: ANNOUNCE: 'goto' for Python

Richie Hindle richie at entrian.com
Thu Apr 1 10:25:54 EST 2004


[Richie]
> This adds the 'goto' and 'comefrom' keywords to Python

[Ville]
> I like it! I especially like the way comefrom maps to how we
> speak. You know, "come here when you are done with the first
> file". Programming is hard for the beginners because there really is
> no direct mapping of many everyday speech idioms, and comefrom goes a
> long way to redeem this for Python. 

Absolutely.

I should have referred to the definitive reference the 'comefrom' statement,
"A Linguistic Contribution to GOTO-less Programming" by R. Lawrence Clark in
Comm. ACM, Vol 27 Nr. 4 (pp. 349-350) (reprint from Datamation, Dec 1973).
[Thanks to Sjoerd Mullender for the full reference.]

I confess that although I've implemented the statement, I've never read this
seminal paper because I couldn't find a free-to-view copy on the web - I don't
suppose anyone knows where such a thing can be found?  I'd be interested to
see whether Mr Clark discusses the English-idiomatic nature of 'comefrom'.

> err = foo()
>     dostuff()
>     domorestuff()
> :if not err

Nice idea, though an 'unless' keyword would make for more idiomatic English
Python - we rarely say "if not".  Also, you probably want to write 'foo()'
*after* 'dostuff' even though it is executed before - consider this example:
"Go and buy some more lubricant, unless you find some in the fridge."

-- 
Richie Hindle
richie at entrian.com





More information about the Python-list mailing list