[Python-ideas] strptime without second argument as an inverse to __str__

Steven D'Aprano steve at pearwood.info
Mon Aug 4 20:15:28 CEST 2014


On Mon, Aug 04, 2014 at 09:17:14AM -0700, Ram Rachum wrote:
> What do you think about having `datetime.strptime`, when called without a 
> `format` for the second argument, be a precise inverse of 
> `datetime.__str__`? This is because I don't currently see an obvious way to 
> get an inverse of `datetime.__str__`, and this seems like an okay place to 
> put it.

Is str(datetime) guaranteed to use a specific format, or is that an 
implementation detail?


-- 
Steven


More information about the Python-ideas mailing list