Message352280
Currently the datetime module has no __all__, which means we only advertise what is public and private based on leading underscores. Additionally, because there are two implementations (Python and C), you actually get different things when you do `from datetime import *` depending on whether you have the C module installed or not.
The "easy" part is to add an __all__ variable to Lib/datetime.py for all the documented attributes:
__all__ = ["date", "datetime", "time", "timedelta", "timezone", "tzinfo", "MINYEAR", "MAXYEAR"]
A "stretch goal" would be to add a test to ensure that `from datetime import *` imports the same set of symbols from the pure python module that it does from the C module. I haven't quite thought through how this would be achieved, probably something in test_datetime (https://github.com/python/cpython/blob/6a517c674907c195660fa9178a7b561de49cc721/Lib/test/test_datetime.py#L1), where we need to import both modules anyway. I think we can accept an "add __all__" PR without tests, though. |
|
Date |
User |
Action |
Args |
2019-09-13 10:23:11 | p-ganssle | set | recipients:
+ p-ganssle, belopolsky |
2019-09-13 10:23:10 | p-ganssle | set | messageid: <1568370190.96.0.124167415349.issue38155@roundup.psfhosted.org> |
2019-09-13 10:23:10 | p-ganssle | link | issue38155 messages |
2019-09-13 10:23:10 | p-ganssle | create | |
|