[Python-Dev] PEP 399: Pure Python/C Accelerator Module Compatibiilty Requirements (original) (raw)

Raymond Hettinger raymond.hettinger at gmail.com
Tue Apr 5 21:57:13 CEST 2011


[Brett]

This PEP requires that in these instances that both the Python and C code must be semantically identical

Are you talking about the guaranteed semantics promised by the docs or are you talking about every possible implementation detail?

ISTM that even with pure python code, we get problems with people relying on implementation specific details.

With C code, I wonder if certain implementation differences go with the territory:

Instead of expressing the wishful thought that C versions and pure Python versions are semantically identical with respect to implementation details, I would like to see more thought put into specific limitations on C coding techniques and general agreement on which implementation specific details should be guaranteed:

A good PEP should address these issues head-on. Just saying that C and python code have to be semantically identical in all implementation details doesn't really address the issue.

[Brett]

(sorry, Raymond, for picking on heapq, but is was what bit the PyPy people most recently =).

No worries, it wasn't even my code. Someone donated it. The was a discusion on python-dev and collective agreement to allow it to have semantic differences that would let it run faster. IIRC, the final call was made by Uncle Timmy.

That being said, I would like to see a broader set of examples rather rather than extrapolating from a single piece 7+ year-old code. It is purely algorithmic, so it really just represents the simplest case. It would be much more interesting to discuss something what should be done with future C implementations for threading, decimal, OrderedDict, or some existing non-trivial C accelerators like that for JSON or XML.

Brett, thanks for bringing the issue up. I've been bugged for a good while about issues like overbroad use of the concrete C API.

Raymond



More information about the Python-Dev mailing list