Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
bpo-30302 Make timedelta.__repr__ more informative. #1493
Currently, the default implementation of datetime.datetime.repr (the default output string produced at the console/IPython) gives a rather cryptic output:
from datetime import datetime as D D.fromtimestamp(1390953543.1) - D.fromtimestamp(1121871596) # datetime.timedelta(3114, 28747, 100000)
For the uninitiated, it is not obvious that the numeric values here are
Would there be any pushback against changing this to:
# datetime.timedelta(days=3114, seconds=28747, microseconds=100000)
Hello, and thanks for your contribution!
I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).
Unfortunately our records indicate you have not signed the CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.
Thanks again to your contribution and we look forward to looking at it!
@vadmium I see what you meant by:
So we'll have to consider the risk of someone's code breaking because it depends on parsing the
Update: Related mail thread addresses the question somewhat: https://marc.info/?l=python-dev&m=145065097122111&w=2
The result of C API function calls always should be checked for error.
There are memory leaks.