overloading logical not, and, or
C. Laurence Gonsalves
clgonsal at kami.com
Wed Jan 30 12:40:36 EST 2002
On 29 Jan 2002 16:49:29 -0500, Kragen Sitaker <kragen at pobox.com> wrote:
> clgonsal at kami.com (C. Laurence Gonsalves) writes:
> > In addition, the 'and' and 'or' operators do "short circuiting". ie:
...
> > operators; they also implement control flow. There isn't an immediately
> > obvious way that could be simulated with __and__ and __or__ methods.
>
> There is to me, but that's because I've been programming more Scheme
> than is good for me.
> a and b()
> becomes
> a.__and__(lambda: b())
I clearly haven't been doing nearly enough Scheme programming lately...
:-)
> But I still don't think it's a good idea!
Agreed.
--
C. Laurence Gonsalves
clgonsal at kami.com
More information about the Python-list
mailing list