Python's standard library datetime
module provides functionality for storing
and manipulating dates and times. But there many other Python time
representations to choose from! In this talk, I'll review a number of them for
features, precision, and performance, and by more subjective considerations such
as clarity and elegance.
Time is a tricky concept. Humans complicate it further by imposing intricate geographical, social, political, astromical, and business units and rules. Many software systems have attempted to model various facets of time measurement and computation. The Python ecosystem is no exception, and provides a wide range of libraries and tools, each with its own features and tradeoffs.
In this talk, I'll discuss some of them: classic "epoch seconds"; the standard library datetime
module; numpy's datetime64
; and various old and new third-party libraries. I'll examine each from a number of angles, such as the features it provides, the special cases it addresses, convenience, and performance in scalar and vector contexts.
No one time representation is the universal winner. My goal is to help you choose the one that fits your specific needs.