On Thursday, September 15, 2016 at 9:12:25 AM UTC+12, Ned Batchelder wrote: > > On Wednesday, September 14, 2016 at 5:00:02 PM UTC-4, Lawrence D’Oliveiro > wrote: >> >> On Thursday, September 15, 2016 at 8:13:05 AM UTC+12, Terry Reedy wrote: >>> >>> Because True is the default, object need not and at least in CPython >>> does not have a __bool__ (or __len__) method. >> >> If they had to (in the absence of which a bool() cast would not work), >> then that would help prevent problems like the one I previously linked to, >> don’t you think? > > Requiring an explicit conversion method wouldn't help the "midnight is > False" problem: it was *caused* by an explicit conversion method.
“Conversion method” versus ”explicit conversion” are two different things. The class provided a method to convert to bool, but Python itself does automatic interpretation of non-boolean values as booleans. It is the latter I am objecting to. -- https://mail.python.org/mailman/listinfo/python-list