Author belopolsky
Recipients Amber.Yust, Andreas.Pelme, Lakin.Wecker, belopolsky, cvrebert, dstufft, eric.araujo, georg.brandl, gwrtheyrn, lemburg, ncoghlan, r.david.murray, shai, tim.peters, yselivanov
Date 2014-03-06.01:27:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1394069278.08.0.658568453097.issue13936@psf.upfronthosting.co.za>
In-reply-to
Content
#20855 was meant as a joke, so I'll keep serious responses here.

Nick wrote:

"""
Alexander, my goal is to flip the default assumption in the time discussion. It is clear from the documentation that the current behaviour is intentional, but there is no concrete *use case* given for it. This is in stark contrast to the other types where treating zero or an empty container differently is quite common, and hence generally unsurprising.
"""

I gave a use case on the list:

if dt.time():
   counts[dt.date()] += 1
else:
   counts[dt.date() - timedelta(1)] += 1

I see nothing wrong with this code and I don't think rewriting it as

if dt.time() != datetime.time(0): ..

is an improvement.

"""
This has resulted in a problem, since the default for most types is that all instances are true, and users mistakenly assume that assumption will hold for datetime.time objects. This is particularly likely for newer users that don't have experience with lower level models of time of day as "seconds since midnight" (which is the mental model where the current behaviour makes sense, and the most plausible rationale for its origins).
"""

datetime module types being spelled in lower-case may be enough of a hint to new users that they should expect the instances to behave more like those of builtin types rather than of user-defined classes.
History
Date User Action Args
2014-03-06 01:27:58belopolskysetrecipients: + belopolsky, lemburg, tim.peters, georg.brandl, ncoghlan, eric.araujo, r.david.murray, cvrebert, gwrtheyrn, Lakin.Wecker, yselivanov, shai, dstufft, Andreas.Pelme, Amber.Yust
2014-03-06 01:27:58belopolskysetmessageid: <1394069278.08.0.658568453097.issue13936@psf.upfronthosting.co.za>
2014-03-06 01:27:57belopolskylinkissue13936 messages
2014-03-06 01:27:55belopolskycreate