Author vstinner
Recipients ezio.melotti, p-ganssle, serhiy.storchaka, vstinner
Date 2020-05-28.14:53:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> 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 For example, nlargest() seems to only be implemented in pure Python.

> I am inclined to say that we should restructure datetime into a folder, containing, and possibly (which I think is also only used in datetime), but I think that sort of restructuring is way more sensitive to weird import bugs than this one.

I have no idea what are the side effects of converting file into a package.

A single file seems more convenient to me. I'm aware of but I don't see it as a datetime submodule and I don't see the value of moving it as a datetime submodule.

I'm fine with _datetime accessing _strptime module. It sounds more complex to me if _datetime would be imported by datetime which contains datetime._strptime. I see a higher risk of subtle import issues, since datetime has two implementations (C and Python). But it may be wrong :-)

Also, all other stdlib modules which have a C implementation are designed with files, not folders: (_io and _pyio) and (_decimal and _pydecimal) are good examples.

I mostly case about reducing the number of indirect imports and import performance. I don't have a strong opinion about file vs folder.

> As it is now, I would be shocked if this didn't break *someone*, because people are always relying on weird implementation details (knowingly or unknowingly), but I think it's worth doing; it's good to tackle it this early in the cycle.

I'm fine with breaking applications relying on implementation details. Also, we can adjust the code to fix such corner cases later if it's needed, possible and justified :-)
Date User Action Args
2020-05-28 14:53:35vstinnersetrecipients: + vstinner, ezio.melotti, serhiy.storchaka, p-ganssle
2020-05-28 14:53:35vstinnersetmessageid: <>
2020-05-28 14:53:35vstinnerlinkissue40799 messages
2020-05-28 14:53:35vstinnercreate