Does Python need a semantics for and/or over generators ? was : 'xor' operator?

Steve Holden sholden at holdenweb.com
Mon Apr 15 13:05:28 EDT 2002


"Grant Edwards" <grante at visi.com> wrote in message
news:YwCu8.32367$vm6.5103753 at ruti.visi.com...
> In article <3CBABA71.3040909 at geneva-link.ch>, Boris Borcic wrote:
>
> > For the shortcut semantics, we'd like to have :
> >      a xor b
> >
> > behave exactly like :
> >      (not b and a) or (not a and b)
>
> I don't understand how that's a shortcut (assuming that means
> the same thing as short-circuit).  You have to evaluate both
> operands of an xor operator.  There is no possibly way to
> short-circuit the expression so that only one is evaluated.
>
But they each might be evaluated *twice* in the given equivalent expression
if the existing Boolean operators didn't short-circuit.

regards
 Steve







More information about the Python-list mailing list