The foo[count:-count] gotcha: -0 silently empties your array slice
theshawwn · x · 2026-10-03
A subtle slicing bug: 0 and -0 are numerically equal, so foo[count:-count] becomes foo[0:0] when count is 0, silently returning an empty array.
The safe expression is foo[count:foo.shape[0]-count]. The author muses that it would be nice if -0 could mean "end of array".
More from coding & agent
- Dev orchestrates ~150 coding agents from his car via Tailscale and a basement server — haydendevs · 2026-10-03
- Dev orchestrates 150 Opus sub-agents from his car via a home server and OpenAI Dot — haydendevs · 2026-10-03
- Gmail MCP Server brings secure email management to MCP clients — modelcontextprotocol · 2026-10-03
- ChapterPal dev: frontier vision models consistently fail to spot obvious webpage conversion artifacts — burkov · 2026-10-03
- Dev finds Argon enough for nearly all coding tasks, misses it after switching to Opus 5.5 — m2saxon · 2026-10-03
- Air-gap file transfer via animated QR codes flashing at 10-30 frames per second — Thionne_WTZ · 2026-10-03