Robert Kern <[EMAIL PROTECTED]> writes: > [EMAIL PROTECTED] wrote: >> Hi, >> >> I'm rather new to Python, and I've just written my first Python C >> module. I was wondering if some more experience Pythonista would look >> over what I've written and given me some pointers (or find some bugs). >> I had a few questions while writing this as well. >> >> Also, I know that there are much better ways to compute nearest >> neighbors than the brute force n^2 method, but this is plenty fast for >> this application (at least the C version is).
You should give up C with a dumb algorithm running at fast speed. Implement a better algorithm in Python, maybe you can even outperform the dumb code. >> 1. How do I add docstrings to my module? > > You mean a docstring on the module object itself? In initmodule() make a > string object with the contents of the docstring and assign it to > module.__doc__ . There might be a more idiomatic way, but I can't think > of it without trawling through the docs. Use Py_InitModule3() instead. Thomas -- http://mail.python.org/mailman/listinfo/python-list