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

Nick Coghlan ncoghlan at gmail.com
Thu Aug 7 19:48:58 CEST 2014


On 8 Aug 2014 03:27, "Alexander Belopolsky" <alexander.belopolsky at gmail.com>
wrote:
>
>
> On Thu, Aug 7, 2014 at 4:17 AM, Wolfgang Maier <
wolfgang.maier at biologie.uni-freiburg.de> wrote:
>>>
>>>
>>> Since parsing will be done in C, it's cost can be made negligible.  In
>>> implementations other than CPython, YMMV.
>>>
>>
>> Why would parsing occur in C ? The datetime module is implemented in
pure Python.
>
>
> No.  In CPython, datetime module is implemented in C.
>
> http://hg.python.org/cpython/file/default/Modules/_datetimemodule.c

Don't we have both these days? (C accelerator with pure Python fallback)

Anyway, I'm +1 for Wolfgang's trio of "fromstr" alternative constructors,
but the suggested variation that allows both " " and "T" as the separator,
rather than accepting a parameter. Anyone wanting more flexibility can use
strptime, or else switch to something like dateutil.

Cheers,
Nick.

>
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140808/b422679a/attachment.html>


More information about the Python-ideas mailing list