On Sat, Jul 16, 2016 at 8:16 PM, Steven D'Aprano <st...@pearwood.info> 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.) ChrisA -- https://mail.python.org/mailman/listinfo/python-list