[Python-Dev] PEP 399: Pure Python/C Accelerator Module Compatibiilty Requirements

Stefan Behnel stefan_ml at behnel.de
Thu Apr 7 07:15:09 CEST 2011


Brett Cannon, 06.04.2011 19:40:
> On Tue, Apr 5, 2011 at 05:01, Nick Coghlan wrote:
>> However, there actually *is* a significant semantic discrepancy in the
>> heapq case, which is that py_heapq is duck-typed, while c_heapq is
>> not:
>>
>> TypeError: heap argument must be a list
>
> That's true. I will re-word it to point that out. The example code still
> shows it, I just didn't explicitly state that in the example.

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?

Stefan



More information about the Python-Dev mailing list