Does Python need a semantics for and/or over generators ? was : 'xor' operator?
Grant Edwards
grante at visi.com
Mon Apr 15 23:19:12 EDT 2002
In article <yNDu8.13611$Ji7.6515 at atlpnn01.usenetserver.com>, Steve Holden wrote:
> "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.
I see. Of course if there _were_ an xor operator, that
wouldn't be a problem...
--
Grant Edwards grante Yow! I will establish
at the first SHOPPING MALL in
visi.com NUTLEY, New Jersey...
More information about the Python-list
mailing list