On Thu, Apr 7, 2011 at 3:15 PM, Stefan Behnel
Assuming there always is an "equivalent" Python implementation anyway, what about using that as a fallback for input types that the C implementation cannot deal with?
Or would it be a larger surprise for users if the code ran slower when passing in a custom type than if it throws an exception instead?
It often isn't practical - the internal structures of the two don't necessarily play nicely together. It's an interesting idea for heapq in particular, though. (The C module fairly could easily alias the Python versions with underscore prefixes, then fallback to those instead of raising an error if PyList_CheckExact fails). Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia