PEP308: Yet another syntax proposal

holger krekel pyth at devel.trillke.net
Mon Feb 10 13:36:36 EST 2003


David Eppstein wrote:
> In article <b28on9$a3l$1 at panix2.panix.com>, aahz at pythoncraft.com (Aahz) 
> wrote:
> 
> > You're missing the point.  How frequently does this occur such that
> > getting all our knickers in a twist is worth it?  So far, most of the
> > examples pushing a conditional expression have *NOT* required
> > short-circut behavior.  For the cases where side-effects restrict the
> > use of a conditional expression, I think perhaps requiring the use of an
> > if statement is the most appropriate way to handle it.
> 
> My feeling is that the reason for short circuiting isn't so much because 
> of side effects (I think we should try to keep expressions as free of 
> side effects as possible) but because one or both of the two sides may 
> be undefined and raise an exception if the guard condition is not met.

right.  in which case learning about and/or (which you have to anyway)
often helps.  Because of the "y is false" problem in "x and y or z"
there are some cases where it doesn't fit.  Do we have real code
examples for them?

    holger





More information about the Python-list mailing list