File tree 1 file changed +15
-1
lines changed
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):
295
295
296
296
Between 0 and 86,399 inclusive.
297
297
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
298
312
299
313
.. attribute :: timedelta.microseconds
300
314
@@ -351,7 +365,7 @@ Supported operations:
351
365
| | same value. (2) |
352
366
+--------------------------------+-----------------------------------------------+
353
367
| ``-t1 `` | Equivalent to ``timedelta(-t1.days, |
354
- | | -t1.seconds* , -t1.microseconds)``, |
368
+ | | -t1.seconds, -t1.microseconds)``, |
355
369
| | and to ``t1 * -1 ``. (1)(4) |
356
370
+--------------------------------+-----------------------------------------------+
357
371
| ``abs(t) `` | Equivalent to ``+t `` when ``t.days >= 0 ``, |
You can’t perform that action at this time.
0 commit comments