

Intro to writing C-extension for Python - synparb
http://danfm.ca/posts/python-c-extensions/
Also has some nice numpy specific stuff for scientific code
======
synparb
This piece also has some nice numpy specific information for scientific
computing.

------
jnazario
FWIW you could have done this in far fewer lines of python using a code
generator like Cython or Pyrex.

that said, learning the intricacies of an extension - and all of the stuff you
have to do under the hood like registering handlers, reference counting,
cleanup, etc - is a valuable experience.

but once you got that done i just recommend you use code generators. it's also
a lot easier to maintain.

------
thepumpkin1979
omg, I suck at math. am I the only one who got intimidated by the math
formula? May be I need a tutorial about C ABI/Python writing wrappers like
"foo_sum" and "bar_multi".

~~~
vog
That's not math. It's just a formula. It is nothing more than the C function,
written in a more compact notation. Consider this notation as some kind of
programming language.

Learning the meaning of math symbols is actually easier than learning a new
programming language, or some cumbersome API. (I assume that you have no
problem picking up a new language, as this article is directed to people who
have learned at least two quite different languages: C and Python.)

So if it's just a formula, what would be math? Math would be describing
exactly what problem is solved by this function, proving that the formula's
result will indeed have the desired properties, and checking all edge cases
and interesting special cases of that function. And on top of all this, math
would analyze the effects of floating point inaccuracies on the result.

So this article doesn't really contain math. It contains just a formula, which
shouldn't be any more intimidating than the corresponding C function.

------
zaptheimpaler
This and Bitey(<https://github.com/dabeaz/bitey>) are both on the front page
:)

------
16s
Boost Python is great for anyone doing C++ Python modules. It's rather simple
too.

~~~
LBarret
but slow.

