Changes by Alexander Belopolsky alexander.belopol...@gmail.com:
--
resolution: - wont fix
stage: - resolved
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18629
___
Changes by Jean-Paul Calderone jean-p...@clusterhq.com:
--
nosy: -exarkun
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18629
___
___
Antoine Pitrou added the comment:
It's not a duplicate.
--
status: pending - open
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18629
___
___
Changes by Serhiy Storchaka storch...@gmail.com:
--
status: open - pending
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18629
___
___
Marc-Andre Lemburg added the comment:
On 03.08.2013 00:47, Alexander Belopolsky wrote:
Alexander Belopolsky added the comment:
Does a result of one and one half seconds make sense as the result of a
floor division operation?
Yes. Timedeltas behave as integers containing the number of
Mark Dickinson added the comment:
I think that's a very obscure interpretation of floor division for
timedeltas :-)
Agreed.
--
nosy: +mark.dickinson
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18629
Alexander Belopolsky added the comment:
What is so special about seconds? Why not days? As in
timedelta(3) // 2
timedelta(1)
Note that in 3.x we have timedelta over timedelta division that lets you do
floor division in arbitrary time units.
What is the use case for timedelta // int that
Mark Dickinson added the comment:
I'm not sure I see a use-case for timedelta // int at all. To make sense of
that, you first need some way to make sense of floor(timedelta), and as you say
it's not clear what that should mean: number of seconds? number of days?
Either of those would seem
Mark Dickinson added the comment:
-1 on changing the behaviour in 2.7, though; I think it's far too late for
that.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18629
___
Marc-Andre Lemburg added the comment:
On 03.08.2013 18:32, Alexander Belopolsky wrote:
Alexander Belopolsky added the comment:
What is so special about seconds? Why not days? As in
timedelta(3) // 2
timedelta(1)
Note that in 3.x we have timedelta over timedelta division that lets
Tim Peters added the comment:
Well, a timedelta is a duration. timedelta // n is as close as possible to one
n'th of that duration, but rounding down (if necessary) so that the result is
representable as a timedelta. In the same way, if i and j are integers, i // j
is as close as possible
Jean-Paul Calderone added the comment:
I think that's a very obscure interpretation of floor division for
timedeltas :-)
Note - I don't care about this. I just want `timedelta / int` to do the same
thing in Python 2.7 with __future__.division as `timedelta / int` does in
Python 3.
Please
Alexander Belopolsky added the comment:
There are two schools of thought here. One school (MAL and Mark) thinks of
durations as real number of seconds. The other school (Tim and I) think of
durations as integer number of resolution intervals. This is why I and Tim
before me resisted adding
Alexander Belopolsky added the comment:
I just want `timedelta / int` to do the same thing in Python 2.7
with __future__.division as `timedelta / int` does in Python 3.
It other words you want to backport timedelta / int true division. I am afraid
it is 3-4 years too late for this request,
Alexander Belopolsky added the comment:
This issue is effectively a duplicate #1083 (see msg101281.)
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18629
___
New submission from Jean-Paul Calderone:
datetime.timedelta instances are divisible by integers on Python 2.7, but not
when __future__.division has been turned on:
exarkun@top:~$ ~/Projects/cpython/2.7/python -c '
from datetime import timedelta
print timedelta(seconds=3) / 2
'
0:00:01.50
Antoine Pitrou added the comment:
You're just looking for floor division:
$ python -Qnew
Python 2.7.4 (default, Apr 19 2013, 18:28:01)
[GCC 4.7.3] on linux2
Type help, copyright, credits or license for more information.
1/2
0.5
from datetime import timedelta
print timedelta(seconds=3) // 2
Jean-Paul Calderone added the comment:
Hm. Maybe I am. Yet isn't true division implemented for this pair of types in
Python 3? I'm not sure why it shouldn't be implemented for them in Python 2.
Also that raises another question. Does a result of one and one half seconds
make sense as the
Madison May added the comment:
I agree -- it's not at all intuitive that the floor division returns a decimal
number of seconds, while float division raises an error. This should probably
be cleaned up.
In python 3.4, both float division and integer division return decimal numbers
of
Changes by Antoine Pitrou pit...@free.fr:
--
nosy: +belopolsky, lemburg
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18629
___
___
Alexander Belopolsky added the comment:
I believe this is related to the fact that timedelta * float is not supported
in 2.x:
Python 2.7.5 (default, May 24 2013, 15:56:16)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type help, copyright, credits or license for more information.
from
Alexander Belopolsky added the comment:
Does a result of one and one half seconds make sense as the result of a floor
division operation?
Yes. Timedeltas behave as integers containing the number of microseconds:
timedelta(microseconds=1) / 2
datetime.timedelta(0)
--
22 matches
Mail list logo