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

Andrew Barnert abarnert at yahoo.com
Wed Aug 6 16:04:52 CEST 2014


On Aug 5, 2014, at 16:12, Terry Reedy <tjreedy at udel.edu> wrote:

> On 8/5/2014 5:35 PM, Andrew Barnert wrote:
>> What you want to get across is that this function parses the default Python representation of datetimes; the fact that it happens to be a subset of ISO format doesn't seem as relevant here. I like the idea of a new alternate constructor, I'm just not crazy about the name.
> 
> Given that str(dti) (datetime instance) is conceptually dt.tostr(dit), name the inverse as dti = dt.fromstr(s).

Wow, now I feel stupid for not thinking of this one.

+00:00:01



More information about the Python-ideas mailing list