Get the latest tech news

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


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.

None

Get the Android app

Or read this on Hacker News

Read more on:

Photo of python

python

Photo of Operator

Operator

Photo of pendulum

pendulum

Related news:

News photo

First Steps into Memory Management in Python

News photo

How Fast is Python 3.15?

News photo

Tapo (Rust/Python library) now speaks TP-Link's TPAP protocol