[issue3250] datetime.time does not support arithmetic

2009-07-06 Thread Chris Withers

Chris Withers ch...@simplistix.co.uk added the comment:

I think so.

FWIW, I'd recommend looking at:

http://pypi.python.org/pypi/python-dateutil

...for doing things that python's builtin datetime stuff doesn't cater 
for.

--
resolution:  - wont fix
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue3250
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3250] datetime.time does not support arithmetic

2009-07-06 Thread Marc-Andre Lemburg

Marc-Andre Lemburg m...@egenix.com added the comment:

Or use the original lib on which this is all based :-)

http://www.egenix.com/products/python/mxBase/mxDateTime/

(and which, of course, does allow subtracting times)

--
nosy: +lemburg

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue3250
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3250] datetime.time does not support arithmetic

2009-07-03 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

If there's no obviously best way to handle overflow, can this be closed?

--
nosy: +ezio.melotti

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue3250
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3250] datetime.time does not support arithmetic

2008-07-06 Thread Skip Montanaro

Skip Montanaro [EMAIL PROTECTED] added the comment:

George To handle overflows, I figured it should wrap around a 24-hour
George limit.

That's precisely the reason that time objects don't support arithmetic.
There is no obviously best way to handle overflow.

--
nosy: +skip.montanaro

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3250
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3250] datetime.time does not support arithmetic

2008-07-04 Thread Chris Withers

Chris Withers [EMAIL PROTECTED] added the comment:

Hi George,

I haven't looked at your patch but that fact that there are no unit
tests and you talk about copying and pasting code, I'd suggest this
might not be a good patch.

Refactor so code is only in one place rather than copying and pasting,
and make sure you write extensive unit tests, especially for things like
date/time...

cheers,

Chris

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3250
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3250] datetime.time does not support arithmetic

2008-07-04 Thread George Boutsioukis

George Boutsioukis [EMAIL PROTECTED] added the comment:

Hi Chris,
 
 I know copy-pasted sounds horrible--perhaps I should have said 'modeled
afterwards'(better marketing;). The thing is, the datetime  time
classes share a lot of common functionality; it is inevitable that some
code looks like it's repeated, because the same process is followed(take
a look at the datetime  date functions already there). 
 I can't see much room for refactoring the arithmetic functions across
classes(seems too messy). Besides, the existing timezone, normalization
and delta functions are used, so no significant logic is repeated.The
patch indeed requires some cleanup, but overall it's good code(and not a
lot of it). 
 I submitted it without tests/doc because I think there should be a
chance for this functionality to be discussed. Also, the datetime module
looks like for some reason these functions were left out(some discussion
I'm missing?).

So before investing any more time on this some feedback would be
appreciated.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3250
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3250] datetime.time does not support arithmetic

2008-07-03 Thread George Boutsioukis

George Boutsioukis [EMAIL PROTECTED] added the comment:

I have also come across this in the past. Although I sense that some
obscure reason might prevent time arithmetic from being included, here's
a patch to add time/timedelta addition and subtraction. It closely
follows the datetime arithmetic functions. To handle overflows, I
figured it should wrap around a 24-hour limit. The timezone stuff is
copied verbatim from the datetime functions, some finger-crossing applied.

--
keywords: +patch
nosy: +gboutsioukis
Added file: http://bugs.python.org/file10806/datetime.diff

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3250
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3250] datetime.time does not support arithmetic

2008-07-01 Thread Chris Withers

New submission from Chris Withers [EMAIL PROTECTED]:

 from datetime import time
 time(9,0)-time(8,0)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: unsupported operand type(s) for -: 'datetime.time' and
'datetime.time'

I'd expect a datetime.timedelta(0,3600)

--
components: Library (Lib)
messages: 69042
nosy: cjw296
severity: normal
status: open
title: datetime.time does not support arithmetic
versions: Python 2.4, Python 2.5

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3250
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3250] datetime.time does not support arithmetic

2008-07-01 Thread Benjamin Peterson

Changes by Benjamin Peterson [EMAIL PROTECTED]:


--
type:  - feature request
versions: +Python 2.7 -Python 2.4, Python 2.5

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3250
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com