>> Python 2.3:
    >> 
    >> >>> import time
    >> >>> time.strftime("%Y-%m-%d", (2005, 6, 4) + (0,)*6)
    >> '2005-06-04'

    Martin> Is there any specific reason you couldn't write

    Martin> "%d-%02d-%02d" % (2005, 6, 4)

    Martin> (i.e. not use strftime at all)?

Sure, but that was just me being lazy typing at the interactive prompt.
%Y-%m-%d is just about the only date format I can ever remember without
consulting the strftime(3) man page. ;-)  Suppose I had used

    >>> time.strftime("%b %d, %Y", (2005, 6, 4) + (1,)*6)
    'Jun 04, 2005'

instead (switching to the all-ones default that still works)?

    Martin> So this was changed in response to a bug report about a crash.

Yeah, but it broke common (at the time) usage.

Skip
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to