[Python-Dev] Issue5434: datetime.monthdelta

2009-04-16 Thread Jess Austin
hi, I'm new to python core development, and I've been advised to write to python-dev concerning a feature/patch I've placed at http://bugs.python.org/issue5434, with Rietveld at http://codereview.appspot.com/25079. This patch adds a monthdelta class and a monthmod function to the datetime

Re: [Python-Dev] Issue5434: datetime.monthdelta

2009-04-16 Thread Tennessee Leeuwenburg
Hi Jess, I'm sorry if I'm failing to understand the use of this function from not looking closely at your code. I'm a bit dubious about the usefulness of this (I'm not sure I understand the use cases), but I'm very open to being convinced. Datetime semantics are very important in some areas -- I

Re: [Python-Dev] Issue5434: datetime.monthdelta

2009-04-16 Thread Oleg Broytmann
On Thu, Apr 16, 2009 at 01:18:01AM -0500, Jess Austin wrote: I'm new to python core development, and I've been advised to write to python-dev concerning a feature/patch I've placed at http://bugs.python.org/issue5434, with Rietveld at http://codereview.appspot.com/25079. I have read the

Re: [Python-Dev] Issue5434: datetime.monthdelta

2009-04-16 Thread skip
date(2008, 1, 30) + monthdelta(1) datetime.date(2008, 2, 29) What would this loop would print? for d in range(1, 32): print date(2008, 1, d) + monthdelta(1) I have this funny feeling that arithmetic using monthdelta wouldn't always be intuitive. Skip

Re: [Python-Dev] Issue5434: datetime.monthdelta

2009-04-16 Thread James Pye
On Apr 16, 2009, at 1:10 AM, Oleg Broytmann wrote: This patch adds a monthdelta class and a monthmod function to the datetime module. The monthdelta class is much like the existing timedelta class, except that it represents months offset from a date, rather than an exact period offset from a

Re: [Python-Dev] Issue5434: datetime.monthdelta

2009-04-16 Thread Amaury Forgeot d'Arc
On Thu, Apr 16, 2009 at 10:45, s...@pobox.com wrote:     date(2008, 1, 30) + monthdelta(1)    datetime.date(2008, 2, 29) What would this loop would print?    for d in range(1, 32):        print date(2008, 1, d) + monthdelta(1) I have this funny feeling that arithmetic using monthdelta

Re: [Python-Dev] Issue5434: datetime.monthdelta

2009-04-16 Thread Dirkjan Ochtman
On Thu, Apr 16, 2009 at 11:54, Amaury Forgeot d'Arc amaur...@gmail.com wrote: In my opinion: arithmetic with months is a mess. There is no such month interval or year interval with a precise definition. If we adopt some kind of month manipulation, it should be a function or a method, like you

Re: [Python-Dev] Issue5434: datetime.monthdelta

2009-04-16 Thread Jon Ribbens
On Thu, Apr 16, 2009 at 12:10:36PM +0400, Oleg Broytmann wrote: This patch adds a monthdelta class and a monthmod function to the datetime module. The monthdelta class is much like the existing timedelta class, except that it represents months offset from a date, rather than an exact

Re: [Python-Dev] RELEASED Python 2.6.2

2009-04-16 Thread Ronald Oussoren
On 15 Apr, 2009, at 22:47, Russell E. Owen wrote: Thank you for 2.6.2. I see the Mac binary installer isn't out yet (at least it is not listed on the downloads page). Any chance that it will be compatible with 3rd party Tcl/Tk? The Mac installer is late because I missed the

Re: [Python-Dev] Issue5434: datetime.monthdelta

2009-04-16 Thread Paul Moore
2009/4/16 Jess Austin jess.aus...@gmail.com: I'm new to python core development, and I've been advised to write to python-dev concerning a feature/patch I've placed at http://bugs.python.org/issue5434, with Rietveld at http://codereview.appspot.com/25079. This patch adds a monthdelta class

Re: [Python-Dev] Issue5434: datetime.monthdelta

2009-04-16 Thread Paul Moore
2009/4/16 s...@pobox.com:     date(2008, 1, 30) + monthdelta(1)    datetime.date(2008, 2, 29) What would this loop would print?    for d in range(1, 32):        print date(2008, 1, d) + monthdelta(1) I have this funny feeling that arithmetic using monthdelta wouldn't always be

Re: [Python-Dev] Issue5434: datetime.monthdelta

2009-04-16 Thread Antoine Pitrou
Paul Moore p.f.moore at gmail.com writes: Oh, certainly! But in the absence of intuitive, I've found in the past that standardised is often better than nothing (For example, I use Oracle's add_months function fairly often - it's not perfect, and not always intuitive, but at least it's

Re: [Python-Dev] PEP 382: Namespace Packages

2009-04-16 Thread P.J. Eby
At 03:46 AM 4/16/2009 +, gl...@divmod.com wrote: On 15 Apr, 09:11 pm, p...@telecommunity.com wrote: I think that there is some confusion here. A main package or buildout that assembles a larger project from components is not the same thing as having a base package for a namespace

Re: [Python-Dev] Issue5434: datetime.monthdelta

2009-04-16 Thread Ned Deily
In article b8ad139e0904152318p5473cbe5yb5f55a19894cc...@mail.gmail.com, Jess Austin jess.aus...@gmail.com wrote: I'm new to python core development, and I've been advised to write to python-dev concerning a feature/patch I've placed at http://bugs.python.org/issue5434, with Rietveld at

Re: [Python-Dev] Issue5434: datetime.monthdelta

2009-04-16 Thread Jess Austin
On Thu, Apr 16, 2009 at 3:45 AM, s...@pobox.com wrote:     date(2008, 1, 30) + monthdelta(1)    datetime.date(2008, 2, 29) What would this loop would print?    for d in range(1, 32):        print date(2008, 1, d) + monthdelta(1) for d in range(1, 32): ... print(date(2008, 1, d) +

Re: [Python-Dev] Issue5434: datetime.monthdelta

2009-04-16 Thread Paul Moore
2009/4/16 Antoine Pitrou solip...@pitrou.net: Paul Moore p.f.moore at gmail.com writes: Oh, certainly! But in the absence of intuitive, I've found in the past that standardised is often better than nothing  (For example, I use Oracle's add_months function fairly often - it's not perfect, and

Re: [Python-Dev] Issue5434: datetime.monthdelta

2009-04-16 Thread Jess Austin
On Thu, Apr 16, 2009 at 5:16 AM, Dirkjan Ochtman dirk...@ochtman.nl wrote: On Thu, Apr 16, 2009 at 11:54, Amaury Forgeot d'Arc amaur...@gmail.com wrote: In my opinion: arithmetic with months is a mess. There is no such month interval or year interval with a precise definition. If we adopt

Re: [Python-Dev] Issue5434: datetime.monthdelta

2009-04-16 Thread Jess Austin
Thanks for everyone's comments! On Thu, Apr 16, 2009 at 9:54 AM, Paul Moore p.f.mo...@gmail.com wrote: I like the idea in principle. In practice, of course, month calculations are inherently ill-defined, so you need to be very specific in documenting all of the edge cases, and you should have

Re: [Python-Dev] RELEASED Python 2.6.2

2009-04-16 Thread Russell Owen
I installed the Mac binary on my Intel 10.5.6 system and it works, except it still uses Apple's system Tcl/Tk 8.4.7 instead of my ActiveState 8.4.19 (which is in /Library/Frameworks where one would expect). I just built python from source and that version does use ActiveState 8.4.19. I

Re: [Python-Dev] Issue5434: datetime.monthdelta

2009-04-16 Thread Jared Grubb
On 16 Apr 2009, at 11:42, Paul Moore wrote: The key thing missing (I believe) from dateutil is any equivalent of monthmod. I agree with that. It's well-defined and it makes a lot of sense. +1 But, I dont think monthdelta can be made to work... what should the following be?

Re: [Python-Dev] Issue5434: datetime.monthdelta

2009-04-16 Thread Robert Kern
On 2009-04-16 13:42, Paul Moore wrote: 2009/4/16 Ned Deilyn...@acm.org: In article b8ad139e0904152318p5473cbe5yb5f55a19894cc...@mail.gmail.com, Jess Austinjess.aus...@gmail.com wrote: I'm new to python core development, and I've been advised to write to python-dev concerning a feature/patch

Re: [Python-Dev] Python-Dev Digest, Vol 69, Issue 143

2009-04-16 Thread Jess Austin
Jared Grubb jared.gr...@gmail.com wrote: On 16 Apr 2009, at 11:42, Paul Moore wrote: The key thing missing (I believe) from dateutil is any equivalent of monthmod. I agree with that. It's well-defined and it makes a lot of sense. +1 But, I dont think monthdelta can be made to work... what

Re: [Python-Dev] Issue5434: datetime.monthdelta

2009-04-16 Thread Jess Austin
Jon Ribbens jon+python-...@unequivocal.co.uk wrote: On Thu, Apr 16, 2009 at 12:10:36PM +0400, Oleg Broytmann wrote: This patch adds a monthdelta class and a monthmod function to the datetime module.  The monthdelta class is much like the existing timedelta class, except that it represents

Re: [Python-Dev] Issue5434: datetime.monthdelta

2009-04-16 Thread Antoine Pitrou
Jess Austin jess.austin at gmail.com writes: What other behavior options besides last-valid-day-of-the-month would you like to see? IMHO, the question is rather what the use case is for the behaviour you are proposing. In which kind of situation is it acceptable to turn 31/2 silently into

Re: [Python-Dev] Issue5434: datetime.monthdelta

2009-04-16 Thread Eric Smith
Jess Austin wrote: What other behavior options besides last-valid-day-of-the-month would you like to see? - Add 30 days to the source date. I'm sure there are others. Followups to python-ideas. ___ Python-Dev mailing list Python-Dev@python.org

Re: [Python-Dev] Issue5434: datetime.monthdelta

2009-04-16 Thread Paul Moore
2009/4/16 Robert Kern robert.k...@gmail.com: On 2009-04-16 13:42, Paul Moore wrote: 2009/4/16 Ned Deilyn...@acm.org: In article b8ad139e0904152318p5473cbe5yb5f55a19894cc...@mail.gmail.com,  Jess Austinjess.aus...@gmail.com  wrote: I'm new to python core development, and I've been advised

Re: [Python-Dev] Issue5434: datetime.monthdelta

2009-04-16 Thread Robert Kern
On 2009-04-16 17:17, Paul Moore wrote: 2009/4/16 Robert Kernrobert.k...@gmail.com: from dateutil.relativedelta import * dt = relativedelta(months=1) dt relativedelta(months=+1) from datetime import datetime datetime(2009, 1, 15) + dt datetime.datetime(2009, 2, 15, 0, 0) datetime(2009, 1,

Re: [Python-Dev] Issue5434: datetime.monthdelta

2009-04-16 Thread Jess Austin
Antoine Pitrou solip...@pitrou.net wrote: Jess Austin jess.austin at gmail.com writes: What other behavior options besides last-valid-day-of-the-month would you like to see? IMHO, the question is rather what the use case is for the behaviour you are proposing. In which kind of situation is

Re: [Python-Dev] Issue5434: datetime.monthdelta

2009-04-16 Thread James Y Knight
On Apr 16, 2009, at 5:47 PM, Antoine Pitrou wrote: IMHO, the question is rather what the use case is for the behaviour you are proposing. In which kind of situation is it acceptable to turn 31/2 silently into 29/2? Essentially any situation in which you'd actually want a next month

Re: [Python-Dev] Issue5434: datetime.monthdelta

2009-04-16 Thread skip
I have this funny feeling that arithmetic using monthdelta wouldn't always be intuitive. Jess I think that's true, especially since these calculations are not Jess necessarily invertible: date(2008, 1, 30) + monthdelta(1) datetime.date(2008, 2, 29) date(2008, 2,

Re: [Python-Dev] Issue5434: datetime.monthdelta

2009-04-16 Thread Tennessee Leeuwenburg
My thoughts on balance regarding monthdeltas: -- Month operations are useful, people will want to do them -- I think having a monthdelta object rather than a method makes sense to me -- I think the documentation is severely underdone. The functionality is not intuitive and therefore the

Re: [Python-Dev] Issue5434: datetime.monthdelta

2009-04-16 Thread Jess Austin
On Thu, Apr 16, 2009 at 7:18 PM, s...@pobox.com wrote:     I have this funny feeling that arithmetic using monthdelta wouldn't     always be intuitive.    Jess I think that's true, especially since these calculations are not    Jess necessarily invertible:     date(2008, 1, 30) +

Re: [Python-Dev] Python-Dev Digest, Vol 69, Issue 143

2009-04-16 Thread Greg Ewing
Jess Austin wrote: This is a perceptive observation: in the absence of parentheses to dictate a different order of operations, the third quantity will differ from the second. Another aspect of this is the use case mentioned right at the beginning of this discussion concerning a recurring

Re: [Python-Dev] Python-Dev Digest, Vol 69, Issue 143

2009-04-16 Thread Tennessee Leeuwenburg
Actually, that's a point. If its' the 31st of Jan, then +1 monthdelta will be 28 Feb and another +1 will be 28 March whereas 31st Jan +2 monthdeltas will be 31 March. That's the kind of thing which really needs to be documented, or I think people really will make mistakes. For example, should a

Re: [Python-Dev] Issue5434: datetime.monthdelta

2009-04-16 Thread Steven D'Aprano
On Fri, 17 Apr 2009 07:41:19 am Jess Austin wrote: Others have suggested raising an exception when a month calculation lands on an invalid date. Python already has that; it's spelled like this: dt = date(2008, 1, 31) dt.replace(month=dt.month + 1) Traceback (most recent call last):

Re: [Python-Dev] Issue5434: datetime.monthdelta

2009-04-16 Thread Steven D'Aprano
On Fri, 17 Apr 2009 12:29:11 pm Steven D'Aprano wrote: Adding one month to 31st January could mean: 1: raise an exception 2: return 28th February (last day of February) 3: return 3rd April (1 month = 31 days) 4: return 2nd April (1 month = 30 days) 5: return 28th February (1 month = 4

Re: [Python-Dev] Issue5434: datetime.monthdelta

2009-04-16 Thread glyph
On 16 Apr, 11:11 pm, f...@fuhm.net wrote: On Apr 16, 2009, at 5:47 PM, Antoine Pitrou wrote: It's a human-interface operation, and as such, everyone (ahem) knows what it means to say 2 months from now, but the details don't usually have to be thought about too much. Of course when you have

Re: [Python-Dev] Issue5434: datetime.monthdelta

2009-04-16 Thread Steven D'Aprano
On Fri, 17 Apr 2009 07:47:14 am Antoine Pitrou wrote: Jess Austin jess.austin at gmail.com writes: What other behavior options besides last-valid-day-of-the-month would you like to see? IMHO, the question is rather what the use case is for the behaviour you are proposing. In which kind of

Re: [Python-Dev] Issue5434: datetime.monthdelta

2009-04-16 Thread skip
Jess If, on the other hand, one of the committers wants to toss this in Jess at some point, whether now or 3 versions down the road, the patch Jess is up at bugs.python.org (and I'm happy to make any suggested Jess modifications). Again, I think it needs to bake a bit. I

Re: [Python-Dev] Python-Dev Digest, Vol 69, Issue 143

2009-04-16 Thread skip
Tennessee If its' the 31st of Jan, then +1 monthdelta will be 28 Feb Tennessee and another +1 will be 28 March whereas 31st Jan +2 Tennessee monthdeltas will be 31 March. Other possible arithmetics: * 31 Jan 2008 + monthdelta(2) might be 31 Jan 2008 + 31 days (# days in

Re: [Python-Dev] Python-Dev Digest, Vol 69, Issue 143

2009-04-16 Thread Steven D'Aprano
On Fri, 17 Apr 2009 12:10:59 pm Tennessee Leeuwenburg wrote: Actually, that's a point. If its' the 31st of Jan, then +1 monthdelta will be 28 Feb and another +1 will be 28 March whereas 31st Jan +2 monthdeltas will be 31 March. That's the kind of thing which really needs to be documented,

Re: [Python-Dev] RELEASED Python 2.6.2

2009-04-16 Thread Ned Deily
In article dd982bd4-02ab-4395-afee-cd3d0eeb7...@u.washington.edu, Russell Owen ro...@u.washington.edu wrote: I installed the Mac binary on my Intel 10.5.6 system and it works, except it still uses Apple's system Tcl/Tk 8.4.7 instead of my ActiveState 8.4.19 (which is in /Library/Frameworks

Re: [Python-Dev] PEP 382: Namespace Packages

2009-04-16 Thread glyph
On 16 Apr, 03:36 pm, p...@telecommunity.com wrote: At 03:46 AM 4/16/2009 +, gl...@divmod.com wrote: On 15 Apr, 09:11 pm, p...@telecommunity.com wrote: Twisted has its own system for namespace packages, and I'm not really sure where we fall in this discussion. I haven't been able to

Re: [Python-Dev] Issue5434: datetime.monthdelta

2009-04-16 Thread Greg Ewing
Steven D'Aprano wrote: 2rd of March on leap years, ^^^ The turd of March? -- Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe:

Re: [Python-Dev] PEP 382: Namespace Packages

2009-04-16 Thread P.J. Eby
At 03:58 AM 4/17/2009 +, gl...@divmod.com wrote: Just as a use-case: would the Java com.* namespace be an example of a pure package with no base? i.e. lots of projects are in it, but no project owns it? Er, I suppose. I was thinking more of the various 'com.foo' and 'org.bar' packages