[issue5434] datetime.monthdelta
Changes by Jess Austin : -- status: open -> pending ___ Python tracker <http://bugs.python.org/issue5434> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5434] datetime.monthdelta
Jess Austin added the comment: Yeah, the masses have spoken, and their silence is deafening. I was going to downplay the "health" of the package based on the number of downloads, but then I looked at the "futures" page. b^) Seriously, getting this in would require a core developer wanting it in, and at this point it seems none do. On the subject of float operations, while there may be some question about the integerness or floatness of timedelta, monthdelta is definitely an integer. As monthdelta already supports multiplication by integers and floor division by integers or monthdeltas, I don't see anything missing. To use monthdeltas with floats is to miss the point entirely. -- status: pending -> open ___ Python tracker <http://bugs.python.org/issue5434> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5516] equality not symmetric for subclasses of datetime.date and datetime.datetime
Jess Austin added the comment: Could you provide some reasoning for such a resolution? I had thought that "won't fix" indicated that the issue wasn't actually an error in behavior. I grant that most people will never see this particular error, but it is an error. -- ___ Python tracker <http://bugs.python.org/issue5516> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5516] equality not symmetric for subclasses of datetime.date and datetime.datetime
Jess Austin added the comment: To be systematic, without the patch: >>> D(1900, 1, 1) > DT(1900, 1, 1) False >>> D(1900, 1, 1) < DT(1900, 1, 1) False >>> DT(1900, 1, 1) > D(1900, 1, 1) Traceback (most recent call last): File "", line 1, in TypeError: can't compare DT to D >>> DT(1900, 1, 1) < D(1900, 1, 1) Traceback (most recent call last): File "", line 1, in TypeError: can't compare DT to D with the patch: >>> D(1900, 1, 1) > DT(1900, 1, 1) True >>> D(1900, 1, 1) < DT(1900, 1, 1) False >>> DT(1900, 1, 1) > D(1900, 1, 1) Traceback (most recent call last): File "", line 1, in TypeError: can't compare DT to D >>> DT(1900, 1, 1) < D(1900, 1, 1) Traceback (most recent call last): File "", line 1, in TypeError: can't compare DT to D It might seem like the latter behavior is marginally better, but really this is just a mess, since a date-datetime comparison TypeErrors in all directions. I appreciate Alexander's more experienced perspective, but it's not obvious to me that this problem is insoluble simply due to OOP algebra. I'm going to keep tinkering with this to see if there isn't a way to satisfy his concerns AND fix these bugs WITHOUT breaking the established (and admittedly anti-OOP) behavior that dates are not equal to datetimes. (Incidentally, the test I removed still seems to be an arbitrary ad-hoc requirement that subclasses of date behave differently than date itself. I don't see how one could rely on this given the other inconsistencies with date subclasses, and so violating this in order to fix more serious problems seems acceptable.) I'm reminded of the set and frozenset situation, which seems almost dual to this one. set and frozenset don't inherit from each other, but they do compare. This seems to bite you only when you try to redefine comparison in subclasses. -- ___ Python tracker <http://bugs.python.org/issue5516> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7116] str.join() should be documented as taking an iterable
Changes by Jess Austin : -- keywords: +patch Added file: http://bugs.python.org/file15111/jointakesiterables.diff ___ Python tracker <http://bugs.python.org/issue7116> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7116] str.join() should be documented as taking an iterable
New submission from Jess Austin : In its __doc__ string and in the documentation, str.join() is described as taking a sequence. This is not general enough; it actually takes any iterable of strings: >>> ','.join(str(x) for x in range(5)) '0,1,2,3,4' Maybe this is a small nit to pick, but it slowed me down for a few minutes, and I already vaguely remembered that str.join() could handle iterables. -- assignee: georg.brandl components: Documentation, Interpreter Core messages: 93909 nosy: georg.brandl, jess.austin severity: normal status: open title: str.join() should be documented as taking an iterable type: behavior versions: Python 2.4, Python 2.5, Python 2.6, Python 2.7, Python 3.0, Python 3.1 ___ Python tracker <http://bugs.python.org/issue7116> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5434] datetime.monthdelta
Changes by Jess Austin : Removed file: http://bugs.python.org/file13696/monthdelta2.diff ___ Python tracker <http://bugs.python.org/issue5434> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5434] datetime.monthdelta
Changes by Jess Austin : Added file: http://bugs.python.org/file13743/monthdelta3.diff ___ Python tracker <http://bugs.python.org/issue5434> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5434] datetime.monthdelta
Jess Austin added the comment: The backport through python 2.3 is up at PyPI: http://pypi.python.org/pypi?name=MonthDelta&:action=display Download source and install, or just easy_install. Documentation is also linked at PyPI. -- ___ Python tracker <http://bugs.python.org/issue5434> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5434] datetime.monthdelta
Changes by Jess Austin : Removed file: http://bugs.python.org/file13309/monthdelta.diff ___ Python tracker <http://bugs.python.org/issue5434> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5434] datetime.monthdelta
Changes by Jess Austin : Added file: http://bugs.python.org/file13696/monthdelta2.diff ___ Python tracker <http://bugs.python.org/issue5434> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2706] datetime: define division timedelta/timedelta
Jess Austin added the comment: A comment on the two most recent patches... For both of these, we can do the following: >>> from datetime import timedelta >>> td = timedelta(12) >>> td datetime.timedelta(12) >>> td //= 3 >>> td datetime.timedelta(4) >>> td //= timedelta(2) >>> td 2 # CHANGED VARIABLE TYPE! I think the last operation will trap unsuspecting programmers, and provide no benefit for the savvy. There really is no reason to allow an in-place operation like this to change the type of the variable so drastically. (That is, I realize a similar thing could happen with ints and floats, but it seems worse with timedeltas and ints.) I feel the last operation should raise a TypeError, even though it would be quite valid for a non-in-place operation. -- nosy: +jess.austin ___ Python tracker <http://bugs.python.org/issue2706> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5434] datetime.monthdelta
Jess Austin added the comment: With the rejection of Issue 5530, it seems best for the name of this class to remain lowercase. Mixing casing schemes within the same module would be perverse. -- title: datetime.MonthDelta -> datetime.monthdelta ___ Python tracker <http://bugs.python.org/issue5434> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5520] refactor test_datetime.py
Jess Austin added the comment: I don't see a point to this one since Issue 5530 was rejected. If someone else wants this they can reopen it. -- status: open -> closed ___ Python tracker <http://bugs.python.org/issue5520> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5516] equality not symmetric for subclasses of datetime.date and datetime.datetime
Jess Austin added the comment: The attached patch fixes this issue, and updates the tests. Contrary to my initial impression, it seems that a previous developer knew of this behavior and thought it correct; see the comment of the test I deleted. I left memcmp() in. -- keywords: +patch Added file: http://bugs.python.org/file13403/issue5516.diff ___ Python tracker <http://bugs.python.org/issue5516> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5530] datetime class names should obey PEP 8 CapWords convention
New submission from Jess Austin : Class names that comply with the CapWords naming convention described in PEP 8 (http://www.python.org/dev/peps/pep-0008/) are preferred. See the recent discussion that included the BDFL's recommendations at http://mail.python.org/pipermail/python-dev/2009-March/086684.html. Per those recommendations, the attached patch updates every class to expose a CapWords name to python: datetime.timedelta --> datetime.TimeDelta datetime.date --> datetime.Date datetime.tzinfo --> datetime.TZInfo datetime.time --> datetime.Time datetime.datetime --> datetime.DateTime In addition, the old lowercase names are reproduced as derived classes, the methods of which throw PendingDeprecationWarning, and the docstrings of which advise using the new CapWords class names. The test_datetime.py unit test is updated to check for proper functionality and for the presence of the pending deprecation warnings. (This patch relies on the previously-submitted refactoring patch attached to Issue 5520, http://bugs.python.org/issue5520.) Various other tests and support files are updated to use the new CapWords class names. The current patch still fails one test in test_datetime.py, due to previously-existing Issue 5516, http://bugs.python.org/issue5516. This patch includes no documentation updates. -- components: Library (Lib) files: pending_dep.diff keywords: patch messages: 83921 nosy: jess.austin severity: normal status: open title: datetime class names should obey PEP 8 CapWords convention type: behavior versions: Python 3.1 Added file: http://bugs.python.org/file13386/pending_dep.diff ___ Python tracker <http://bugs.python.org/issue5530> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5520] refactor test_datetime.py
Changes by Jess Austin : Removed file: http://bugs.python.org/file13376/test_datetime.diff ___ Python tracker <http://bugs.python.org/issue5520> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5520] refactor test_datetime.py
Changes by Jess Austin : Added file: http://bugs.python.org/file13385/test_datetime.diff ___ Python tracker <http://bugs.python.org/issue5520> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5520] refactor test_datetime.py
New submission from Jess Austin : I've broken out this refactoring from some of the other datetime stuff I'm doing. The patch needn't be applied until the other issues that depend on it are. -- components: Library (Lib) files: test_datetime.diff keywords: patch messages: 83822 nosy: jess.austin severity: normal status: open title: refactor test_datetime.py versions: Python 3.1 Added file: http://bugs.python.org/file13376/test_datetime.diff ___ Python tracker <http://bugs.python.org/issue5520> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5516] equality not symmetric for subclasses of datetime.date and datetime.datetime
Changes by Jess Austin : -- title: equality not reflexive for subclasses of datetime.date and datetime.datetime -> equality not symmetric for subclasses of datetime.date and datetime.datetime ___ Python tracker <http://bugs.python.org/issue5516> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5516] equality not reflexive for subclasses of datetime.date and datetime.datetime
Changes by Jess Austin : -- title: equality not reflixive for subclasses of datetime.date and datetime.datetime -> equality not reflexive for subclasses of datetime.date and datetime.datetime ___ Python tracker <http://bugs.python.org/issue5516> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5516] equality not reflixive for subclasses of datetime.date and datetime.datetime
New submission from Jess Austin : While the datetime.date and datetime.datetime classes consistently handle mixed-type comparison, their subclasses do not: >>> from datetime import date, datetime, time >>> d = date.today() >>> dt = datetime.combine(d, time()) >>> d == dt False >>> dt == d False >>> class D(date): ... pass ... >>> class DT(datetime): ... pass ... >>> d = D.today() >>> dt = DT.combine(d, time()) >>> d == dt True >>> dt == d False I think this is due to the premature "optimization" of using memcmp() in date_richcompare(). -- components: Library (Lib) messages: 83798 nosy: jess.austin severity: normal status: open title: equality not reflixive for subclasses of datetime.date and datetime.datetime type: behavior versions: Python 2.4, Python 2.5, Python 2.6, Python 2.7, Python 3.0, Python 3.1 ___ Python tracker <http://bugs.python.org/issue5516> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5434] datetime.MonthDelta
Changes by Jess Austin : Removed file: http://bugs.python.org/file13258/datetimemodule.diff ___ Python tracker <http://bugs.python.org/issue5434> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5434] datetime.MonthDelta
Changes by Jess Austin : Added file: http://bugs.python.org/file13309/monthdelta.diff ___ Python tracker <http://bugs.python.org/issue5434> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5434] datetime.MonthDelta
Jess Austin added the comment: This prototype python implementation passes the same tests that the C implementation in the patch does (modulo import differences). I'll probably backport this for 2.x versions. -- Added file: http://bugs.python.org/file13307/monthdelta.py ___ Python tracker <http://bugs.python.org/issue5434> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5434] datetime.MonthDelta
Jess Austin added the comment: Rietveld link: http://codereview.appspot.com/25079 ___ Python tracker <http://bugs.python.org/issue5434> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5434] datetime.MonthDelta
Jess Austin added the comment: This is my first try at a patch. All functionality, tests, and documentation are included, but I won't be surprised if I need to make some changes! Please let me know. -- keywords: +patch Added file: http://bugs.python.org/file13258/datetimemodule.diff ___ Python tracker <http://bugs.python.org/issue5434> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5434] datetime.MonthDelta
New submission from Jess Austin : datetime is a wonderful module. Perhaps the only inconvenient aspect of using it is dealing with month calculations and comparisons. This patch adds a simple class, monthdelta, which represents date offsets in terms of months. It supports basic integer-like arithmetic, and also it may be added to dates and datetimes. It deals sensibly with leap-year and month-length issues. Also provided is a function, monthmod (named by imperfect analogy to divmod), which allows round-tripping: that is, taking 2 dates and returning a (monthdelta, timedelta) tuple that represents the interim between the dates. Note: I have named the class "monthdelta", but in light of recent python-dev discussions I should probably rename this to "MonthDelta". -- components: Library (Lib) messages: 83272 nosy: jess.austin severity: normal status: open title: datetime.MonthDelta type: feature request versions: Python 3.1 ___ Python tracker <http://bugs.python.org/issue5434> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com