There's also the solution that was proposed a long time ago but never implemented (because it's using a somewhat complex heuristic): occasionally remove cancelled timers from the heapq. This is what pyftpdlib uses.
That approach wouldn't deal with non-timer Handlers that are cancelled, but I'm not sure how common that use case is (the OP specifically mentioned timeouts). I've got a feeling that occasionally it might be useful to have the callback+args show up in a handler's repr(), even if it is cancelled, but I'm not sure how valuable that is in practice. -- --Guido van Rossum (python.org/~guido)
