[Python-3000] __format__ and datetime

Eric Smith eric+python-dev at trueblade.com
Tue Sep 11 03:30:27 CEST 2007


Paul Moore wrote:
> I'd like to see the default format specified (somewhere). I note that
> the default format for datetime values seems to differ for me (on
> 3.0a1 on Windows)
> 
> Python 3.0a1 (py3k:57844, Aug 31 2007, 16:54:27) [MSC v.1310 32 bit
> (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import datetime
>>>> str(datetime.datetime.now())
> '2007-09-10 16:26:25.218000'
> 
> (Note lack of 'T'). I'm not sure I like 6 decimal places of seconds to
> be the default format, either, but consistency (with str()) and
> accuracy (however extreme) may be more important here...

This is my error.  I caught it while adding tests, and I'll fix it 
before I check anything in.  format(datetime.datetime.now(), '') will 
not have a 'T' in it, just as str(datetime.datetime.now()) doesn't.



More information about the Python-3000 mailing list