[Python-Dev] the not operator (and the not special method) (original) (raw)
Guido van Rossum guido@python.org
Thu, 03 Oct 2002 20:19:43 -0400
- Previous message: [Python-Dev] the not operator (and the __not__ special method)
- Next message: [Python-Dev] the not operator (and the __not__ special method)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[...] I guess it will be also good to have the special methods for the logical operations 'and', 'or' and 'not', (something like land, lor and lnot to distinguish them from the bitwise versions and and or).
So, if you overload the proper logical methods, you can write something like cond = not (sin(x) > 0.5 ) and ( b <= 0.5 )_ _where 'not' and 'and', like '>' and '<=', wil return anything you want.
Sorry, that won't be possible any time soon. If I allowed these operators to be overloaded, they would lose their shortcut properties, which are the reason for their existence.
--Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-Dev] the not operator (and the __not__ special method)
- Next message: [Python-Dev] the not operator (and the __not__ special method)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]