[issue40799] Create Lib/_pydatetime.py file to optimize "import datetime" when _datetime is available

2020-06-26 Thread Paul Ganssle
Paul Ganssle added the comment: As for deciding between moving to `datetime/` and moving to `_pydatetime`, I think we should send an e-mail to Python-Dev about it to get a wider perspective, because the import machinery is a lot of black magic, and I know that there are large proprietary

[issue40799] Create Lib/_pydatetime.py file to optimize "import datetime" when _datetime is available

2020-06-26 Thread Paul Ganssle
Paul Ganssle added the comment: > bout _strptime, I see that the time.strptime() imports internally the > _strptime module. Ah, sorry, my remark about including `_strptime` was off the cuff — I thought it was only used in `datetime`, which is why I said "possibly _strptime". If it's used

[issue40799] Create Lib/_pydatetime.py file to optimize "import datetime" when _datetime is available

2020-06-25 Thread hai shi
Change by hai shi : -- nosy: +shihai1991 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue40799] Create Lib/_pydatetime.py file to optimize "import datetime" when _datetime is available

2020-06-01 Thread STINNER Victor
STINNER Victor added the comment: About _strptime, I see that the time.strptime() imports internally the _strptime module. If we move _strptime inside datetime: does it mean that calling time.strptime() would have to import the datetime module? It doesn't sound right to me. I see the time

[issue40799] Create Lib/_pydatetime.py file to optimize "import datetime" when _datetime is available

2020-05-28 Thread STINNER Victor
STINNER Victor added the comment: > I believe that there are other modules that have similar situations like > heapq, but datetime is probably the worst offender. heapq seems to be a little bit different. _heapq is not a drop-in replacement of heapq.py. For example, nlargest() seems to only

[issue40799] Create Lib/_pydatetime.py file to optimize "import datetime" when _datetime is available

2020-05-28 Thread Paul Ganssle
Paul Ganssle added the comment: I basically agree with this — this is one of the reasons I structured the zoneinfo module the way I did rather than mimicking the pattern in datetime. I believe that there are other modules that have similar situations like heapq, but datetime is probably the

[issue40799] Create Lib/_pydatetime.py file to optimize "import datetime" when _datetime is available

2020-05-28 Thread STINNER Victor
STINNER Victor added the comment: > What do decimals have to datetime? Oops. Sorry, I was confused between "datetime" and "decimal" when I created this issue. I fixed the issue title. My idea is to mimick Lib/decimal.py design for Lib/datetime.py. --

[issue40799] Create Lib/_pydatetime.py file to optimize "import datetime" when _datetime is available

2020-05-28 Thread STINNER Victor
Change by STINNER Victor : -- title: Create Lib/_pydecimal.py file to optimize "import datetime" when _decimal is available -> Create Lib/_pydatetime.py file to optimize "import datetime" when _datetime is available ___ Python tracker