Operator Precedence/Boolean Logic

Rustom Mody rustompmody at gmail.com
Sat Jul 16 08:33:13 EDT 2016


On Saturday, July 16, 2016 at 4:16:34 PM UTC+5:30, Chris Angelico wrote:
> On Sat, Jul 16, 2016 at 8:16 PM, Steven D'Aprano  wrote:
> >> If both you and Chris tripped up on a right definition of an “empty”
> >> automaton and regex respectively, I believe it demonstrates that getting
> >> boolishness for an arbitrary type right is at least non-trivial. [FWIW My
> >> belief: In general its nonsensical]
> >
> > Firstly, I disagree that I tripped up on anything. You haven't given any
> > reason to think that Automata objects shouldn't be truthy, and even if you
> > do, isn't that just a matter of opinion?
> 
> I also disagree that I "tripped up", but there is room for differing
> decisions in API design, and this is one of them. I can't say
> perfectly, from my armchair (which I'm not in anyway - way too
> cumbersome for a desktop computer), which objects are capable of being
> "empty" and which are not. The implementer of the automaton class or
> the regex class has to decide what counts as "empty". As Steven says,
> the default is that they're all truthy, and onus is on the implementer
> to demonstrate that this object is functionally equivalent to 0 or an
> empty collection. (And it's possible for ANYONE to get that wrong - cf
> timedelta.)

Just to re-iterate what we are talking about (and before you continue 
to score self-goals):

You folks — Chris and Steven — likely know a lot more python than I do – no one
questioning that.

You also have a bizarre notion that python's property: “Everything has
auto-bool-nature” IS STRAIGHTFORWARD.

My point of those examples is to show that with such an outlook you will invariably trip up.

Python in fact has a well established rheostat for this:
Simple → Complex → Complicated

If we agree to this bool business being complicated then we are being honest
If we agree to it being complex — well euphemisms are necessary in civilized society I guess
If however you insist its simple, you will trip up.
And the fact that that may be nothing to do with trick questions posed by me is
seen in the other thread where Peter saw a subtle distinction in boolishness
that we all missed.

So yes “Anyone can get that wrong” is a self-goal
You are making my point and then saying you disagree.
With what/whom?   Yourself??



More information about the Python-list mailing list