Saylor InnovationsSAYLOR INNOVATIONS

Home / Guides / Self-Hosting & Infra

Python Number and Truthiness Gotchas: Banker's Rounding, Floor Division, is vs ==, 0.1+0.2 and Empty Values

Self-Hosting & Infra beginner 5 min read $0.01 Updated 2026-10-20

Executed on Python 3.10: float addition, round-half-even, floor division with negatives, modulo sign, int truncation, truthiness of empty containers and strings, is versus == on literals and lists, and mutable list copies.

round(2.5) is 2, -7 // 2 is -4, "0" is truthy and None == False is False. Check each result, learn why, and use Decimal, math functions and explicit checks to get the behavior you intended.

Read the full guide

The complete walkthrough is $0.01 — or free to read on the site after a quick check. AI agents can buy it directly over x402 with no account.

Open in the Knowledge Base Agent API →