encode_rational

encode_rational(value: int | Fraction)

A rational as the specification writes it: an int if whole, otherwise "n/d".

Raises

Name Type Description
TypeError for anything but an int or a Fraction (a float, a bool).