[issue18827] mistake in the timedelta.total_seconds docstring

2013-08-24 Thread Alexander Schier

New submission from Alexander Schier:

 Return the total number of seconds contained in the duration. Equivalent to 
 (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6 
 computed with true division enabled.

Should be
 Return the total number of seconds contained in the duration. Equivalent to 
 (td.microseconds / 10**6 + (td.seconds + td.days * 24 * 3600) * 10**6) 
 computed with true division enabled.

At least i hope, the bug is only in the docs and not in the function ;).

--
assignee: docs@python
components: Documentation
messages: 196100
nosy: allo, docs@python
priority: normal
severity: normal
status: open
title: mistake in the timedelta.total_seconds docstring
type: behavior
versions: Python 2.7

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



[issue18827] mistake in the timedelta.total_seconds docstring

2013-08-24 Thread Tim Peters

Tim Peters added the comment:

The docs look correct to me.  For example,

 from datetime import *
 td = datetime.now() - datetime(1,1,1)
 td
datetime.timedelta(735103, 61756, 484000)
 td.total_seconds()
63512960956.484
^
What the docs say match that output:

 (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 1e6
63512960956.484

Your suggestion's output:

 (td.microseconds / 1e6 + (td.seconds + td.days * 24 * 3600) * 10**6)
6.3512960956e+16

You're multiplying the number seconds by a million - not a good idea ;-)

--
nosy: +tim.peters

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



[issue18827] mistake in the timedelta.total_seconds docstring

2013-08-24 Thread Alexander Schier

Alexander Schier added the comment:

Err, sorry my fault. Too late in the evening ;).

I saw the division by one million, but not the multiplation by one million 
before. Additionally i was confused, because i expected that seconds are added 
to each other in the parenthesis.

closing.

--
resolution:  - invalid
status: open - closed

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