|
|
Subscribe / Log in / New account

A false midnight

A false midnight

Posted Mar 14, 2014 17:37 UTC (Fri) by duelafn (subscriber, #52974)
In reply to: A false midnight by Karellen
Parent article: A false midnight

First: I agree that it was a poor choice to make midnight False.

However, the comparison to a float where every int is false is not exactly a fair comparison since a datetime is always True. Compare instead to a Decimal implemented as a pair: (DecimalIntPart, DecimalFractionalPart). Then making the DecimalFractionalPart be False when the Decimal is an integer is much more reasonable:

if my_decimal.fractional_part: print("Is not an integer")

It, to me, makes the original implementation seem less "completely insane" and more "not the best choice".


to post comments


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds