File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -295,6 +295,20 @@ Instance attributes (read-only):
295295
296296 Between 0 and 86,399 inclusive.
297297
298+ .. caution ::
299+
300+ It is a somewhat common bug for code to unintentionally use this attribute
301+ when it is actually intended to get a :meth: `~timedelta.total_seconds `
302+ value instead:
303+
304+ .. doctest ::
305+
306+ >>> from datetime import timedelta
307+ >>> duration = timedelta(seconds = 11235813 )
308+ >>> duration.days, duration.seconds
309+ (130, 3813)
310+ >>> duration.total_seconds()
311+ 11235813.0
298312
299313.. attribute :: timedelta.microseconds
300314
@@ -351,7 +365,7 @@ Supported operations:
351365| | same value. (2) |
352366+--------------------------------+-----------------------------------------------+
353367| ``-t1 `` | Equivalent to ``timedelta(-t1.days, |
354- | | -t1.seconds* , -t1.microseconds)``, |
368+ | | -t1.seconds, -t1.microseconds)``, |
355369| | and to ``t1 * -1 ``. (1)(4) |
356370+--------------------------------+-----------------------------------------------+
357371| ``abs(t) `` | Equivalent to ``+t `` when ``t.days >= 0 ``, |
You can’t perform that action at this time.
0 commit comments