Paul G added the comment:

@r.david.murray In the other thread, you mention that the full test suite is 
run against the C and Python implementations, so that answers the question of 
how to write the tests.

I think treating it as an enhancement in Python 3.7 makes a reasonable amount 
of sense - it's clearly under-specified at the moment and people are probably 
relying on the CPython behavior (dateutil definitely is in the latest stable 
release, but not on master). Saying "it's implementation-specific before Python 
3.7 but in Python 3.7+, the spec says it should use self(type)" is fine by me. 
It's not particularly hard to work around if you're subclassing datetime anyway.

Among the major libraries that provide their own datetime objects:

- Arrow seems to use composition 
(https://github.com/crsmithdev/arrow/blob/master/arrow/arrow.py)
- pendulum subclasses, but implements their own "replace": 
https://github.com/sdispater/pendulum/blob/master/pendulum/pendulum.py#L25
- delorean uses composition: 
https://github.com/myusuf3/delorean/blob/master/delorean/dates.py#L174
- maya uses composition: 
https://github.com/kennethreitz/maya/blob/master/maya/core.py#L72

I'd say for the most part it's not a major issue to change it even as a bugfix, 
particularly if the line we're going with is "it was always 
implementation-specific", but there's also no rush.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue31222>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to