4 ms·
It's not really very hard if you know the basics of C, the only weird part is having to deal with a bunch of Py* functions and types to interface with Python's.
by icebraining 12y ago
It's not really very hard if you know the basics of C, the only weird part is having to deal with a bunch of Py* functions and types to interface with Python's.
The official docs are nice: https://docs.python.org/2/extending/extending.html https://docs.python.org/2/extending/extending.html
- masklinn 12y agoIf all you want is to call into C code, without needing to really expose that code as Python objects, CFFI[0] is probably a simpler path. [0] https://cffi.readthedocs.org/en/release-0.8/ https://cffi.readthedocs.org/en/release-0.8/
- shadowmint 12y agoI dont know if you've ever tried this using python3, but the Unicode internals make it significantly more complex.
- MichaelGG 12y agoWow I just read up on that. Python 3 is from the late '00s but it still uses fixed 16-bit characters? That's just silly. Pay double the price for most strings, and still get Unicode support wrong. And then the newer versions "fix" this by allowing 32-bit characters? And even newer versions can do a different encoding per string? I know people like O(1) indexing into strings, but I'm unconvinced it's so useful to totally fuck up your string implementation. Java, Windows and .Net have the excuse of being thought up before Unicode was over 16-bits so it's slightly excusable (but still a bad tradeoff for many, many, applications, probably the majority of server apps).