Implicit conversion to boolean in if and while statements

Ian Kelly ian.g.kelly at gmail.com
Sun Jul 15 19:45:10 CEST 2012


On Sun, Jul 15, 2012 at 11:16 AM, Andrew Berg <bahamutzero8825 at gmail.com> wrote:
> On 7/15/2012 11:19 AM, Ian Kelly wrote:
>> Ugh, that's irritating.  I can't think of any scenario where I would
>> ever want the semantics "if timeval (is not midnight):".
> It's not implemented with such a test, but
> logging.handlers.TimedRotatingFileHandler has an option to rollover at
> midnight.

Nor could it be implemented with such a test, since the rollover check
would then have to run at exactly midnight for the test to evaluate
false.  If it were off by 1 microsecond, it would miss it.



More information about the Python-list mailing list