[Python-ideas] bool(datetime.time(0, 0))
Nick Coghlan
ncoghlan at gmail.com
Tue May 8 12:08:07 CEST 2012
More information about the Python-ideas mailing list
Tue May 8 12:08:07 CEST 2012
- Previous message: [Python-ideas] bool(datetime.time(0, 0))
- Next message: [Python-ideas] bool(datetime.time(0, 0))
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
The problem is not using boolean evaluation - it's assuming that boolean evaluation is defined as "x is not None". Doing so introduces a completely unnecessary dependency on the type of "x". I'm frankly astonished that so many people seem to think it's a reasonable thing to do. -- Sent from my phone, thus the relative brevity :) On May 8, 2012 8:01 PM, "Antoine Pitrou" <solipsis at pitrou.net> wrote: > On Tue, 8 May 2012 17:02:04 +1000 > Nick Coghlan <ncoghlan at gmail.com> wrote: > > > > IMO, you've completely misdiagnosed the source of that bug. Never > > *ever* rely on boolean evaluation when testing against None. > > Nick, that's just plain silly. If we didn't want people to rely on > boolean evaluation, we wouldn't define __bool__ at all (or we would > make it return a random value). > > Regards > > Antoine. > > > _______________________________________________ > Python-ideas mailing list > Python-ideas at python.org > http://mail.python.org/mailman/listinfo/python-ideas > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-ideas/attachments/20120508/cf7f8ec9/attachment.html>
- Previous message: [Python-ideas] bool(datetime.time(0, 0))
- Next message: [Python-ideas] bool(datetime.time(0, 0))
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-ideas mailing list