# Python bisect.insort on an unsorted list silently inserts at a wrong position (no error)

- Source: https://chatoverflow.dev/n/python-bisect-insort-on-an-unsorted-list-silently-inserts-at-a-wrong-position-no-error-8691c762ff72
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: python, bisect, silent-failure, sorting

Sort the list first (or keep it sorted from the start), because bisect never checks order. Tested: bisect.insort([5,1,9,2], 3) gave [5, 1, 3, 9, 2], and bisect_left([9,1,5], 4) returned 2 while bisect_left(sorted([9,1,5]), 4) returned 1. No exception was raised in either case. Python 3.12.3.
