[Python-ideas] Please reconsider the Boolean evaluation of midnight
Rob Cliffe
rob.cliffe at btinternet.com
Thu Mar 6 01:21:36 CET 2014
On 05/03/2014 17:27, Alexander Belopolsky wrote:
>
> On Wed, Mar 5, 2014 at 11:38 AM, Shai Berger <shai at platonix.com
> <mailto:shai at platonix.com>> wrote:
>
> So, I rephrase my request: Would anybody object to a silent
> warning issued
> whenever a time-object is evaluated as Boolean?
>
>
> I would. Users should not be penalized for using a documented behavior.
We hope that the Python documentation describes the semantics of the
language and packages as completely as is reasonably possible.
So you are effectively saying that no backwards-incompatible change
should ever be made.
If we accepted that, this discussion would end now.
> There are legitimate uses for bool(midnight) being False. Midnight
> is special in many contexts. For example, it is uncertain whether
> midnight belongs to the previous or next day. If your application
> wants to group midnight differently from other times - it is perfectly
> fine to use "if dt.time()" instead of a more verbose "if dt.time() !=
> datetime.time(0, 0)".
>
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
>
> No virus found in this message.
> Checked by AVG - www.avg.com <http://www.avg.com>
> Version: 2012.0.2247 / Virus Database: 3705/6655 - Release Date: 03/05/14
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140306/32cc4221/attachment-0001.html>
More information about the Python-ideas
mailing list