Efficient counting of results

MRAB python at mrabarnett.plus.com
Thu Oct 19 23:25:43 EDT 2017


On 2017-10-20 03:32, Chris Angelico wrote:
> On Fri, Oct 20, 2017 at 12:18 PM, Steve D'Aprano
> <steve+python at pearwood.info> wrote:
>> On Fri, 20 Oct 2017 05:28 am, Israel Brewster wrote:
>>> So if the date of
>>> the first record was today, t1 was on-time, and t2 was 5 minutes late, then
>>> I would need to increment ALL of the following (using your data structure
>>> from above):
>>>
>>> d10, w10, m10, y10, d25, w25, m25 AND y25
>>
>> Try using descriptive variable names rather than these cryptic codes.
>>
>> I don't understand what is *actually* being computed here -- you say that t1
>> is "on time" and t2 is "5 minutes late", but that's a contradiction: how can
>> a single record be both on time and 5 minutes late?
> 
> t1 and t2 are independent actions/timepoints, AIUI. So t1 could be the
> time the order was put into the oven, and t2 is the time it got
> delivered to the person's door. I'm assuming, here, that this database
> records pizzas, because why not. An order could have been compiled and
> put into the oven on time, but still delivered late; or it could be
> ovened slightly late, but thanks to the new high-speed delivery
> drones, it was actually at the customer's doorstep on time.
> 
Also, AIUI:

   If it was on-time today, then it was also on-time this week, this 
month, and this year.

   If it was on-time yesterday, then it was also on-time this week, this 
month, and this year, but not today.

   If it was on-time eight days ago, then it was also on-time this 
month, and this year, but not this week.

Excepting that he's dealing with calendar weeks, calendar months, etc, 
so yesterday might not be counted as being in this week (or month, or 
even year!).

I think.



More information about the Python-list mailing list