Zentrader wrote:
> On Sep 6, 7:56 am, [EMAIL PROTECTED] wrote:
>> December 31, 2006    January 13, 2007 # doesn't earn
>> January 14, 2007        January 27, 2007 # does earn
>> January 28, 2007        February 10, 2007 # doesn't
>> February 11, 2007       February 24, 2007 # does
> 
> Am I over simplifying if I say that since it appears to be a two week
> pay period, the date has to be greater than the 11th unless the first,
> or first and second, are on a weekend, in which case it would be > 12
> or > 13?  Or a reasonable facsimile thereof, depending on whether or
> not the two week period is Saturday through Friday.

I think it's one of those things where the neatest answer
could well depend on the sort of heuristic you mention. As
a rule, when I come across this kind of requirement, I tend
to put the most general solution in place, unless a *real*
optimisation is clearly called for. In my experience, this
makes it much easier for the next person who looks at the
code, typically years later, even if that's me!

(This is has just happened to me this week, having to review
a date-related calculation to do the repost frequency of the
adverts my company deals with. I wrote the original code five
years ago, and commented it intelligently, but I *still* had
to work through the code twice when we had a problem with a
particular cycle!)

TJG
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to