Operator Precedence/Boolean Logic

Rustom Mody rustompmody at gmail.com
Sat Jul 16 01:58:50 EDT 2016


>From other thread:

On Saturday, July 16, 2016 at 9:50:13 AM UTC+5:30, Ethan Furman wrote:
> On 07/15/2016 09:04 PM, Rustom Mody wrote:
> 
> > Just that suggesting that python's bool notion is straightforward is an
> > unnecessary lie – especially to newbies.
> 
> Python's boolean concept is as simple as it gets -- what is not straightforward about it?

And to expand on my

On Saturday, July 16, 2016 at 11:18:48 AM UTC+5:30, Rustom Mody wrote:
> FWIW My belief: In general its nonsensical

C's 0 is false; rest-of-universe is true is a mess
Python increases the mess by making the false-y candidates also non-singleton

This seems to work for container-like objects like lists,strings,sets, etc
with None and 0 being somewhat elliptical analogues

But when we allow __bool__ to be available for any and every thing and give
it some implicit random definition, this is just plain nonsense.

[What is the bool-nature -- aka Buddha-nature -- of graphs question remains yet answered]



More information about the Python-list mailing list