Re: [Python-Dev] datetime module enhancements

2007-03-10 Thread Nick Coghlan
Christian Heimes wrote: >>From the README.txt > pytz brings the Olson tz database into Python. This library allows > accurate and cross platform timezone calculations using Python 2.3 > or higher. It also solves the issue of ambiguous times at the end > of daylight savings, which you can read more

Re: [Python-Dev] datetime module enhancements

2007-03-10 Thread Jon Ribbens
"Phillip J. Eby" <[EMAIL PROTECTED]> wrote: > At 09:20 PM 3/9/2007 +, Jon Ribbens wrote: > >If you want the answer to be "the entire of that day" then you need > >to alter the datetime module so that, e.g. subtracting 2007-03-08 > >from 2007-03-09 does not return "one day" as currently, but ret

Re: [Python-Dev] datetime module enhancements

2007-03-10 Thread Sjoerd Mullender
On 03/09/2007 08:56 PM, Martin v. Löwis wrote: -- Sjoerd Mullender > Christian Heimes schrieb: >> BJörn Lindqvist schrieb: >>> I think it should be a ValueError, given that the programmer is very >>> likely to further use the returned timestamp to for example insert >>> stuff in a database. Unix t

Re: [Python-Dev] datetime module enhancements

2007-03-10 Thread Jon Ribbens
Steven Bethard <[EMAIL PROTECTED]> wrote: > Using the .date() is fine when the year/month/day doesn't match. So > the following are fine:: > datetime.datetime(2005, 1, 1, 0, 0, 0) < datetime.date(2006, 1, 1) > datetime.datetime(2007, 1, 1, 0, 0, 0) > datetime.date(2006, 1, 1) > It's *not*

[Python-Dev] Non implementation dependent access to calling scope

2007-03-10 Thread Michael Foord
Hello all, I realise that this may be more relevant to Python ideas, in which case feel free to ignore this (and my apologies). I occasionally see code looking (something) like : calling_scope = sys._getframe(1).f_globals['__name__'] This looks and smells like a hack (not least because of the

Re: [Python-Dev] datetime module enhancements

2007-03-10 Thread Christian Heimes
Jon Ribbens schrieb: > So you're deciding that a 'date' is 'the entire of that day', except > when you subtract two of them, when it suddenly means something else? ;-) It makes kinda sense although it looks like a contradiction at first. The common linguistic usage of dates in English and German:

Re: [Python-Dev] datetime module enhancements

2007-03-10 Thread Jon Ribbens
Christian Heimes <[EMAIL PROTECTED]> wrote: > Jon Ribbens schrieb: > > So you're deciding that a 'date' is 'the entire of that day', except > > when you subtract two of them, when it suddenly means something else? ;-) > > It makes kinda sense although it looks like a contradiction at first. > > T

Re: [Python-Dev] Non implementation dependent access to calling scope

2007-03-10 Thread Martin v. Löwis
Michael Foord schrieb: > Hello all, > > I realise that this may be more relevant to Python ideas, in which case > feel free to ignore this (and my apologies). > > I occasionally see code looking (something) like : > > > calling_scope = sys._getframe(1).f_globals['__name__'] > > This looks and

Re: [Python-Dev] Encouraging developers

2007-03-10 Thread A.M. Kuchling
On Fri, Mar 09, 2007 at 10:10:48PM -0800, Neal Norwitz wrote: > We should probably be a lot more aggressive about closing bugs and > patches without response. Unfortunately many fall into this category. This question comes up every so often, and after much discussion I think python-dev always con

Re: [Python-Dev] datetime module enhancements

2007-03-10 Thread Christian Heimes
Jon Ribbens schrieb: > What do you feel "next Tuesday plus 12 hours" means? ;-) First thought: It's nonsense! Nobody would say that. ;) Second though: Tuesday noon (12h after the beginning of Tuesday) Christian ___ Python-Dev mailing list Python-Dev@

Re: [Python-Dev] Non implementation dependent access to calling scope

2007-03-10 Thread Michael Foord
Martin v. Löwis wrote: > Michael Foord schrieb: >> Hello all, >> >> I realise that this may be more relevant to Python ideas, in which >> case feel free to ignore this (and my apologies). >> >> I occasionally see code looking (something) like : >> >> >> calling_scope = sys._getframe(1).f_globals['

Re: [Python-Dev] datetime module enhancements

2007-03-10 Thread Jon Ribbens
Christian Heimes <[EMAIL PROTECTED]> wrote: > > What do you feel "next Tuesday plus 12 hours" means? ;-) > > First thought: It's nonsense! Nobody would say that. ;) > > Second though: Tuesday noon (12h after the beginning of Tuesday) I agree with you entirely. Your suggestions correspond to 'thr

Re: [Python-Dev] datetime module enhancements

2007-03-10 Thread Collin Winter
On 3/9/07, Christian Heimes <[EMAIL PROTECTED]> wrote: > Collin Winter schrieb: > > I can't say I'm well-versed in the intricacies of date/time issues, > > but what you say makes sense. This is exactly why I brought this patch > > up here : ) > > Oh h...! Seems like I've opened a can of worms here.

[Python-Dev] unittest enhancement for TestCase classes hierarchies

2007-03-10 Thread Collin Winter
In my continuing trawl through the SF patch tracker, I came across #1244929 (http://python.org/sf/1244929), which causes TestLoader.loadTestsFromModule() to skip classes whose name starts with an underscore. This addresses the warning in that method's docs: """ While using a hierarchy of TestCase-

Re: [Python-Dev] unittest enhancement for TestCase classes hierarchies

2007-03-10 Thread Jean-Paul Calderone
On Sat, 10 Mar 2007 09:13:28 -0600, Collin Winter <[EMAIL PROTECTED]> wrote: >In my continuing trawl through the SF patch tracker, I came across >#1244929 (http://python.org/sf/1244929), which causes >TestLoader.loadTestsFromModule() to skip classes whose name starts >with an underscore. This addre

Re: [Python-Dev] datetime module enhancements

2007-03-10 Thread Robert Brewer
On 3/9/07, Collin Winter <[EMAIL PROTECTED]> wrote: > > On the subject of datetime enhancements, I came > > across an SF patch (#1673403) the other day that > > proposed making it possible to compare date and > > datetime objects. > > One solution that just occurred to me -- and that > skirts the

Re: [Python-Dev] datetime module enhancements

2007-03-10 Thread Jon Ribbens
Robert Brewer <[EMAIL PROTECTED]> wrote: >> One solution that just occurred to me -- and that >> skirts the issue of choosing an interpretation -- >> is that, when comparing date and datetime objects, >> the datetime's .date() method is called and the >> result of that call is c

Re: [Python-Dev] Non implementation dependent access to calling scope

2007-03-10 Thread Guido van Rossum
Looks like you misunderstand what's going on. sys._getframe() *intentionally* smells like a hack, becase we don't *want* you to feel comfortable using it. Its mere existence may constrain other Python implementations from optimizing the code they generate; it is a compromise to enable those project

Re: [Python-Dev] datetime module enhancements

2007-03-10 Thread Steven Bethard
On 3/10/07, Jon Ribbens <[EMAIL PROTECTED]> wrote: > Steven Bethard <[EMAIL PROTECTED]> wrote: > > Using the .date() is fine when the year/month/day doesn't match. So > > the following are fine:: > > datetime.datetime(2005, 1, 1, 0, 0, 0) < datetime.date(2006, 1, 1) > > datetime.datetime(2

Re: [Python-Dev] datetime module enhancements

2007-03-10 Thread Jon Ribbens
Steven Bethard <[EMAIL PROTECTED]> wrote: > I don't see why the docs can't be explicit about what subtraction > means given that there are a number of possible interpretations. I don't see why the docs can't be explicit about what comparison means given that there are a number of possible interpre

Re: [Python-Dev] Encouraging developers

2007-03-10 Thread Neal Norwitz
On 3/10/07, A.M. Kuchling <[EMAIL PROTECTED]> wrote: > On Fri, Mar 09, 2007 at 10:10:48PM -0800, Neal Norwitz wrote: > > We should probably be a lot more aggressive about closing bugs and > > patches without response. Unfortunately many fall into this category. > > This question comes up every so

[Python-Dev] fmod.c

2007-03-10 Thread Paul Hankin
Hi all, Is there any need for Python/fmod.c any more? I can't see how it can be included because there's no test for fmod in the ./configure script and grepping all files in the tree for fmod.c finds nothing except a commented out line in PC/os2vacpp/makefile.omk If it is needed, it needs fixing

Re: [Python-Dev] datetime module enhancements

2007-03-10 Thread Collin Winter
On 3/10/07, Robert Brewer <[EMAIL PROTECTED]> wrote: > On 3/9/07, Collin Winter <[EMAIL PROTECTED]> wrote: > > > On the subject of datetime enhancements, I came > > > across an SF patch (#1673403) the other day that > > > proposed making it possible to compare date and > > > datetime objects. >

Re: [Python-Dev] datetime module enhancements

2007-03-10 Thread Steven Bethard
On 3/10/07, Jon Ribbens <[EMAIL PROTECTED]> wrote: > Steven Bethard <[EMAIL PROTECTED]> wrote: > > I still don't see why my more careful comparison would be bad for any > > of your code. Could you give an example where it would be bad for all > > the following to be False:: > > date(2006, 1, 1

Re: [Python-Dev] datetime module enhancements

2007-03-10 Thread Collin Winter
On 3/10/07, Collin Winter <[EMAIL PROTECTED]> wrote: > On 3/9/07, Christian Heimes <[EMAIL PROTECTED]> wrote: > > Collin Winter schrieb: > > > I can't say I'm well-versed in the intricacies of date/time issues, > > > but what you say makes sense. This is exactly why I brought this patch > > > up he

Re: [Python-Dev] unittest enhancement for TestCase classes hierarchies

2007-03-10 Thread Collin Winter
On 3/10/07, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > On Sat, 10 Mar 2007 09:13:28 -0600, Collin Winter <[EMAIL PROTECTED]> wrote: > >In my continuing trawl through the SF patch tracker, I came across > >#1244929 (http://python.org/sf/1244929), which causes > >TestLoader.loadTestsFromModule(

Re: [Python-Dev] datetime module enhancements

2007-03-10 Thread Greg Ewing
Jon Ribbens wrote: > So you're deciding that a 'date' is 'the entire of that day', except > when you subtract two of them, when it suddenly means something else? ;-) No, you're considering dates to be discrete entities, like integers. You wouldn't use the same reasoning to argue that the differen

Re: [Python-Dev] datetime module enhancements

2007-03-10 Thread Tristan Seligmann
* Christian Heimes <[EMAIL PROTECTED]> [2007-03-10 03:58:27 +0100]: > >From the README.txt > pytz brings the Olson tz database into Python. This library allows > accurate and cross platform timezone calculations using Python 2.3 > or higher. It also solves the issue of ambiguous times at the end >

Re: [Python-Dev] datetime module enhancements

2007-03-10 Thread Christian Heimes
Tristan Seligmann schrieb: > pytz.timezone('Africa/Johannesburg') > > # SAST is UTC+2 not UTC+1.5 > pytz.timezone('Etc/GMT+2')._utcoffset > datetime.timedelta(-1, 79200) > # I thought I asked for GMT+2, not GMT-2 > > > ---

Re: [Python-Dev] datetime module enhancements

2007-03-10 Thread Christian Heimes
Tristan Seligmann wrote: > Unfortunately, it would appear that the Olson tz database contains some > rather... uh... confusing data. For example: > pytz.timezone('Africa/Johannesburg') > > # SAST is UTC+2 not UTC+1.5 The tz of Africa/Johannesburg initially started with an offset of 1h30 bef

Re: [Python-Dev] datetime module enhancements

2007-03-10 Thread Jon Ribbens
I see you snipped without response my request to back up your claim that "assuming that a date() is a datetime() with a time of midnight will clearly break that logic". Am I to assume you cannot back it up? ___ Python-Dev mailing list Python-Dev@python.o

Re: [Python-Dev] datetime module enhancements

2007-03-10 Thread Greg Ewing
Jon Ribbens wrote: > What do you feel "next Tuesday plus 12 hours" means? ;-) I would say it's meaningless. My feeling is that subtracting two dates should give an integer number of days, and that is all you should be allowed to add to a date. -- Greg