[Tutor] Preference to Bitwise operators in comparison to Logical operators
Alan Gauld
alan.gauld at yahoo.co.uk
Fri Sep 11 04:37:12 EDT 2020
On 11/09/2020 00:26, Matt Ruffalo wrote:
> Note that 'and' and 'or' are not technically Boolean operators; they are
> *control flow* operators. These return one of the operands, not
> necessarily True or False.
While that's true they are not intended to be used for control flow,
that's just a feature of their implementation (it's how C does it!).
But they have been like that since the beginning so changing them
to pure booleans would break a lot of code.
But the intent of 'and', 'or', 'not' is to be used as logical
boolean operators. That's why thy are listed as such in the
Reference (sect 6.11)
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list