PEP 308: Discussion Summary

David Eppstein eppstein at ics.uci.edu
Thu Feb 20 10:48:52 EST 2003


In article <m2znorz2td.fsf at mycroft.actrix.gen.nz>,
 Paul Foley <see at below.invalid> wrote:

> I made a similar suggestion: [cond1 -> expr1; cond2 -> expr2; ...] a
> week or so ago.
> 
> I think using commas to separate the clauses is a bad idea; semicolons
> work much better, and "->" is more a obvious choice than ":".  There's
> no need for a "default" value (I'd raise an exception if none of the
> conditions are met)

Semicolons are overloaded.  If you're going to do something like this, 
|| (double vertical bar) might be better for expressing the disjunctive 
nature of the expression while having some visual similarity to Hoare's 
CSP notation.  Also while Hoare used square brackets I think that would 
be a mistake here, just use parens (don't make them part of the 
notation, but set precedence of the operators low enough that they'd be 
necessary in most contexts).

I'd vote against this, anyway, by the way: from an elegance of design 
point of view I like CSP but from a readability point of view I don't 
think it works.

-- 
David Eppstein       UC Irvine Dept. of Information & Computer Science
eppstein at ics.uci.edu http://www.ics.uci.edu/~eppstein/




More information about the Python-list mailing list