Hi Stefan. 2011/6/30 Stefan Behnel <stefan...@behnel.de>: > Don't miss out taking a look at Cython, just in case it's going to be a > non-trivial project.
I think this work still qualifies as trivial enough in this regard. But thanks for the hint! > There's a PEP for Py3 that enables this through a general framework. In > general, to achieve this, you may want to allocate the module content > (including types etc.) on the heap rather than statically. > > http://www.python.org/dev/peps/pep-3121/ Perfect! Unfortunately, it seems not to be available in 2.x, so unusable for now. For the foreseeable future the project can not depend on 3.x as many (internal) target systems are "stable", i.e. are not updated besides security stuff. > Take a look at PyCapsule, it may (or may not) be enough for your use case. Also a perfectly good solution - unfortunately the same comment about 3.0 applies here. > However, note the comment about Py_InitModule4() in the docs, where it says > that the 'self' passing feature isn't used very often. You may or may not > want to (or need to) use it. If there are too many hoops to jump through to get a reasonable solution working for 2.[567], I might as well go back to Py_InitModule() and static variables. It's somewhat ugly, but it works. Thanks for the info! Daniel -- http://mail.python.org/mailman/listinfo/python-list