[Python-ideas] Statements vs Expressions... why?

Greg Ewing greg.ewing at canterbury.ac.nz
Mon Sep 15 02:50:41 CEST 2008


Cliff Wells wrote:

> A potential solution would to be to use a different keyword than "yield"
> to separate current syntax from my proposed syntax

But inserting any kind of keyword into LCs is going
to make them ugly and verbose. The point of having
LCs in the first place is that they express certain
kinds of things very concisely. Adding keywords and
colons to them messes that up.

Likewise with conditional expressions. It would be
disappointing if, instead of

   x = a if b else c

we had to write

   x = if a: b else: c

Colons in the middle of expressions look ugly, IMO.

-- 
Greg



More information about the Python-ideas mailing list