datetime iso8601 string input

Magnus Lycka lycka at carmen.se
Fri Feb 24 04:27:03 EST 2006


Rubic wrote:
> I can understand why datetime can't handle
> arbitrary string inputs, but why not just
> simple iso8601 format -- i.e. the default
> output format for datetime?

Have you actually read the ISO 8601 standard?
If you have, you would know that parsing valid
ISO 8601 is fairly close to handling arbitrary
strings...

I suspect this absence is quite deliberate.

There are so many possible string formats that
are used and prefered in different situations,
and various loop holes with time zones and DST
etc, that it's probably better to let the
programmer take full responsibility over this
instead of providing a 10% solution.

ater all, it isn't very hard to use for instance
time.strptime() with some appropriate format,
and build datetime objects from that. Then
the programmer is in control.



More information about the Python-list mailing list