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

Nick Coghlan ncoghlan at gmail.com
Thu Apr 7 08:59:24 CEST 2011


On Thu, Apr 7, 2011 at 3:15 PM, Stefan Behnel <stefan_ml at behnel.de> wrote:
> 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 at gmail.com   |   Brisbane, Australia


More information about the Python-Dev mailing list