← Back to events
CoolingTech

Why Pendulum had to write the most cursed "+" operator in all of Python

What happened

Pendulum is a popular Python library for working with datetimes. Its + operator is unusual, even for a datetime library: when you add a timedelta to a Pendulum DateTime, it consults the call stack to decide which answer to give you. What? And why? The hack itself is on its way out, but the design behind it still matters for your code.

Summary assembled by rule from the sources below

Why it's spreading

Sources