[Python-Dev] "and" and "or" operators in Py3.0
Ron Adam
rrr at ronadam.com
Tue Sep 20 02:38:25 CEST 2005
Raymond Hettinger wrote:
> I propose that in Py3.0, the "and" and "or" operators be simplified to
> always return a Boolean value instead of returning the last evaluated
> argument.
>
> 1) The construct can be error-prone. When an error occurs it can be
> invisible to the person who wrote it. I got bitten in published code
> that had survived testing and code review:
Yes, I wondered about that possibility myself.
+1
> P.S. Simplifying "and" and "or" may create a need to introduce a
> conditional operator but that is a discussion for another day.
You would still be able to use multiply to covert a comparison to a value.
Cheers,
Ron
More information about the Python-Dev
mailing list