Is there a module for an AVL tree or a red–black tree or some other type of a balanced binary tree in the standard library of Python?
No, there is not a balanced binary tree in the stdlib. However, from your comments, it sounds like you may have some other options:
O(log n)
searches. If searching is all you need and your data are already sorted, the bisect
module provides a binary search algorithm for lists.If neither solution works well for you, you'll have to go to a third party module or implement your own.