Saturday, July 4, 2020

Talk Python to Me: #271 Unlock the mysteries of time, Python's datetime that is!

Time is a simple thing, right? And working with it in Python is great. You just import datetime and then (somewhat oddly) use the datetime class from that module. <br/> <br/> Oh except, there are times with timezones, and times without. And why is there a total_seconds() but not total_minutes(), hours() or days() on timedelta? How about computing the number of weeks? <br/> <br/> What if you wanted to iterate over the next 22 workdays, skipping weekends? <br/> <br/> Ok, we'd better talk about time in Python! Good thing Paul Ganssle is here. He's a core developer who controls time in CPython.<br/> <br/> <strong>Links from the show</strong><br/> <br/> <div><b>Talk Python Training Humble Bundle</b>: <a href="https://ift.tt/2ZvsPcg" target="_blank" rel="noopener">humblebundle.com</a><br/> <br/> <b>Paul on Twitter</b>: <a href="https://twitter.com/pganssle" target="_blank" rel="noopener">@pganssle</a><br/> <b>Paul's Blog</b>: <a href="https://ift.tt/2BBzOIM" target="_blank" rel="noopener">blog.ganssle.io</a><br/> <b>Paul's Website</b>: <a href="https://ganssle.io/" target="_blank" rel="noopener">ganssle.io</a><br/> <br/> <b>Datetime blog posts</b><br/> <b>pytz: The fastest footgun in the West</b>: <a href="https://ift.tt/2pnIp8F" target="_blank" rel="noopener">blog.ganssle.io</a><br/> <b>Stop using utcnow and utcfromtimestamp</b>: <a href="https://ift.tt/2Cehl1A" target="_blank" rel="noopener">blog.ganssle.io</a><br/> <b>A curious case of non-transitive datetime comparison</b>: <a href="https://ift.tt/2ELw0o3" target="_blank" rel="noopener">blog.ganssle.io</a><br/> <b>Semantics of timezone-aware datetime arithmetic</b>: <a href="https://ift.tt/2YIiUSn" target="_blank" rel="noopener">blog.ganssle.io</a><br/> <br/> <b>PEPs</b><br/> <br/> <b>PEP 495: Local time disambiguation</b>: <a href="https://ift.tt/1g3pCrW" target="_blank" rel="noopener">python.org</a><br/> <b>PEP 615: Support for the IANA Time Zone Database in the Standard Library</b>: <a href="https://ift.tt/2VNxUMX" target="_blank" rel="noopener">python.org</a><br/> <br/> <b>zoneinfo documentation in Python 3.9</b>: <a href="https://ift.tt/2NTjLsj" target="_blank" rel="noopener">docs.python.org</a><br/> <b>backports.zoneinfo</b>: <a href="https://ift.tt/2AuaVye" target="_blank" rel="noopener">pypi.org</a><br/> <b>pytz_deprecation_shim</b>: <a href="https://ift.tt/3dXfONR" target="_blank" rel="noopener">readthedocs.io</a><br/> <br/> <b>Extra libraries</b><br/> <b>dateutil</b>: <a href="https://ift.tt/2l1GA0v" target="_blank" rel="noopener">readthedocs.io</a><br/> <b>break-my-python</b>: <a href="https://ift.tt/2DaKLBG" target="_blank" rel="noopener">pypi.org</a><br/> <b>arrow</b>: <a href="https://ift.tt/2feoS5U" target="_blank" rel="noopener">readthedocs.io</a><br/> <b>pendulum</b>: <a href="https://ift.tt/2aH1fPd" target="_blank" rel="noopener">pendulum.eustace.io</a><br/> <br/> <b>Indiana Time Zones</b>: <a href="https://ift.tt/2NTjN3p" target="_blank" rel="noopener">google.com</a><br/></div><br/> <strong>Sponsors</strong><br/> <br/> <a href='https://ift.tt/2PTb42Q> <a href='https://ift.tt/2PVc9qH Python Training</a>

from Planet Python
via read more

No comments:

Post a Comment

TestDriven.io: Working with Static and Media Files in Django

This article looks at how to work with static and media files in a Django project, locally and in production. from Planet Python via read...