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

2009-04-16 Thread glyph
On 04:56 am, p...@telecommunity.com wrote: 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

Re: [Python-Dev] RELEASED Python 2.6.2

2009-04-16 Thread Ronald Oussoren
On 16 Apr, 2009, at 20:58, Russell Owen 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 where one would expect). That's very string. I had ActiveSt

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' packag

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

2009-04-16 Thread Greg Ewing
Steven D'Aprano wrote: it should be obvious in the same way that string concatenation is different from numerical addition: 1 + 2 = 2 + 1 '1' + '2' != '2' + '1' However, the proposed arithmetic isn't just non- commutative, it's non-associative, which is a much rarer and more surprising thing

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: http://mail.python.org/mailman/options/python-de

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 fo

Re: [Python-Dev] RELEASED Python 2.6.2

2009-04-16 Thread Ned Deily
In article , Russell Owen 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 where one would > expect). > > I just built python from source and th

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 documen

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 i

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 unde

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 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 situ

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 ha

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 =

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 ca

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] 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 event

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

2009-04-16 Thread Jess Austin
On Thu, Apr 16, 2009 at 7:18 PM, 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) + monthd

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 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) >>> dat

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" oper

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

2009-04-16 Thread Jess Austin
Antoine Pitrou wrote: > Jess Austin 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

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 Kern: 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, 31) + dt datetime.dat

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

2009-04-16 Thread Paul Moore
2009/4/16 Robert Kern : > On 2009-04-16 13:42, Paul Moore wrote: >> >> 2009/4/16 Ned Deily: >>> >>> In article >>> , >>>  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.py

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 htt

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

2009-04-16 Thread Antoine Pitrou
Jess Austin 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 29/2? ___

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

2009-04-16 Thread Jess Austin
Jon Ribbens 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 months offset from a

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

2009-04-16 Thread Jess Austin
Jared Grubb 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 should the >

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 Deily: In article , 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.

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? print(date(200

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 Jess Austin
Thanks for everyone's comments! On Thu, Apr 16, 2009 at 9:54 AM, Paul Moore 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 > strong use case

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

2009-04-16 Thread Jess Austin
On Thu, Apr 16, 2009 at 5:16 AM, Dirkjan Ochtman wrote: > On Thu, Apr 16, 2009 at 11:54, Amaury Forgeot d'Arc > 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 manip

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

2009-04-16 Thread Jess Austin
On Thu, Apr 16, 2009 at 4:54 AM, Amaury Forgeot d'Arc wrote: > FWIW, the Oracle database has two methods for adding months: > 1- the add_months() function >    add_months(to_date('31-jan-2005'), 1) > 2- the ANSI interval: >    to_date('31-jan-2005') + interval '1' month > > "add_months" is calenda

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

2009-04-16 Thread Paul Moore
2009/4/16 Ned Deily : > In article > , >  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. > > Without ha

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

2009-04-16 Thread Paul Moore
2009/4/16 Antoine Pitrou : > Paul Moore 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 intu

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

2009-04-16 Thread Jess Austin
On Thu, Apr 16, 2009 at 3:45 AM, 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) + mont

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

2009-04-16 Thread Ned Deily
In article , 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. Without having looked at the code, I wonder

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 pack

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

2009-04-16 Thread Antoine Pitrou
Paul Moore 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 well-def

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

2009-04-16 Thread Paul Moore
2009/4/16 : >    >>> 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.

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

2009-04-16 Thread Paul Moore
2009/4/16 Jess Austin : > 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

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 pre-announceme

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

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

2009-04-16 Thread Dirkjan Ochtman
On Thu, Apr 16, 2009 at 11:54, Amaury Forgeot d'Arc 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 would do

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

2009-04-16 Thread Amaury Forgeot d'Arc
On Thu, Apr 16, 2009 at 10:45, 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 would

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 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 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 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 u