Re: Difference between two times (working ugly code, needs polish)

2007-09-12 Thread Shawn Milochik
> Just to be picky - your function returns the number of days between > two dates, but it's called isOld, which looks like it should return a > boolean. i.e. it looks like it would be used as: > > if not isOld(auctionDate, currentTime): > checkForBid() > > rather than how I assume it is used:

Re: Difference between two times (working ugly code, needs polish)

2007-09-12 Thread Iain King
On Sep 12, 1:31 am, "Shawn Milochik" <[EMAIL PROTECTED]> wrote: > > I suppose really oneDay should be a global (i.e. outside the function > > definition). Apart from that it would be hard to improve on: obvious, > > easy to read, in short - pythonic. > > > Are you concerned about daylight savings?

Re: Difference between two times (working ugly code, needs polish)

2007-09-11 Thread Shawn Milochik
> > I suppose really oneDay should be a global (i.e. outside the function > definition). Apart from that it would be hard to improve on: obvious, > easy to read, in short - pythonic. > > Are you concerned about daylight savings? That could certainly introduce > a whole new level of complexity into

Re: Difference between two times (working ugly code, needs polish)

2007-09-11 Thread Steve Holden
Shawn Milochik wrote: > On 9/11/07, Grant Edwards <[EMAIL PROTECTED]> wrote: >> On 2007-09-11, Shawn Milochik <[EMAIL PROTECTED]> wrote: >> >>> I have done what I wanted, but I think there must be a much better way. >> See the strptime() function in either the time or the datetime >> modules: >> >>

Re: Difference between two times (working ugly code, needs polish)

2007-09-11 Thread Shawn Milochik
On 9/11/07, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2007-09-11, Shawn Milochik <[EMAIL PROTECTED]> wrote: > > > I have done what I wanted, but I think there must be a much better way. > > See the strptime() function in either the time or the datetime > modules: > > http://docs.python.org/lib/

Re: Difference between two times (working ugly code, needs polish)

2007-09-11 Thread Bruno Desthuilliers
Shawn Milochik a écrit : > I have done what I wanted, but I think there must be a much better way. > > Given two timestamps in the following format, I just want to figure > out how far apart they are (in days, seconds, whatever). > > Format: > > -MM-DD_MM:SS > > Example: > 2007-09-11_16:41

Re: Difference between two times (working ugly code, needs polish)

2007-09-11 Thread Grant Edwards
On 2007-09-11, Shawn Milochik <[EMAIL PROTECTED]> wrote: > I have done what I wanted, but I think there must be a much better way. See the strptime() function in either the time or the datetime modules: http://docs.python.org/lib/module-time.html http://docs.python.org/lib/module-datetime.html

Difference between two times (working ugly code, needs polish)

2007-09-11 Thread Shawn Milochik
I have done what I wanted, but I think there must be a much better way. Given two timestamps in the following format, I just want to figure out how far apart they are (in days, seconds, whatever). Format: -MM-DD_MM:SS Example: 2007-09-11_16:41 It seems to me that to do what I want, I need