On Thu, Jul 23, 2020 at 5:51 AM Tim Chase <python.l...@tim.thechases.com> wrote: > > On 2020-07-22 11:54, Oscar Benjamin wrote: > >> On Wed, Jul 22, 2020 at 11:04 AM Tim Chase wrote: > >>> reading through the language specs and didn't encounter > >>> anything about booleans returned from comparisons-operators, > >>> guaranteeing that they always return The One True and The One > >>> False. > >> > >> That said, though, a comparison isn't required to return a bool. > >> If it *does* return a bool, it has to be one of those exact two, > >> but it could return anything it chooses. But for built-in types > >> and most user-defined types, you will indeed get a bool. > > > > I'm not sure if this is relevant to the question but thought I'd > > mention concrete examples. A numpy array will return non-bool for > > both of the mentioned operators > > that is indeed a helpful data-point. Do you know of any similar > example in the standard library of things where comparison-operators > return something other than True or False (or None)? >
Can't think of any (although that doesn't disprove it). Also, nothing returns None from a comparison, to my knowledge. ChrisA -- https://mail.python.org/mailman/listinfo/python-list