overloading logical not, and, or
Kragen Sitaker
kragen at pobox.com
Tue Jan 29 16:49:29 EST 2002
More information about the Python-list mailing list
Tue Jan 29 16:49:29 EST 2002
- Previous message (by thread): overloading logical not, and, or
- Next message (by thread): overloading logical not, and, or
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
clgonsal at kami.com (C. Laurence Gonsalves) writes: > In addition, the 'and' and 'or' operators do "short circuiting". ie: > they don't always evaluate their second parameter, depending upon the > value of the first parameter. This makes them more than normal > 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()) But I still don't think it's a good idea!
- Previous message (by thread): overloading logical not, and, or
- Next message (by thread): overloading logical not, and, or
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list