On Aug 16, 9:46 am, MRAB <[EMAIL PROTECTED]> wrote:
>
> As well as the other replies, this also works (as far as I can tell!):
>
> import time
> today = time.localtime()
> yesterday = today[ : 2] + (today[2] - 1, ) + today[3 : ]
> yesterday = time.localtime(time.mktime(yesterday))

This is something I have wondered about.  The C library mktime
function is
documented to fix up out of range values,.  For example July 32
becomes
August 1 and August -1 becomes July 31.  Python presumably inherits
this
very useful (and seemingly not well known) behavior, but it is not
documented.  Is this just an oversight, or is it intentional on the
grounds
that it might be platform-dependent?  Any language lawyers out there
that
would care to comment?

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

Reply via email to