[Python-ideas] Statements vs Expressions... why?
Cliff Wells
cliff at develix.com
Sun Sep 14 23:45:04 CEST 2008
On Sun, 2008-09-14 at 14:41 -0700, Cliff Wells wrote:
> On Sun, 2008-09-14 at 23:34 +0200, Mathias Panzenböck wrote:
> > If I understand this right, then this would become legal too:
> >
> > x = if cond(a):
> > return b
>
> return would always be a syntax error outside of a function.
>
> >
> > So what value is assigned to x when cond(a) is True, what value when it is
> > False?
>
> x = if False: 1 # evaluates to None
> x = if True: 1 # evalutates to True
I meant "evaluates to 1", of course.
Cliff
More information about the Python-ideas
mailing list