extension-modules

_functools module

How does this import work, what file does it use? import _functools in python 2.5 : import _functools print _functools.__file__ Traceback (most recent call last): File "D:\zjm_code\mysite\zjmbooks\a.py", line 5, in <module> print _functools.__file__ AttributeError: 'module' object has no attribute '__file__' and how can i g...

Creating Instance of Python Extension Type in C

I am writing a simple Vector implementation as a Python extension module in C that looks mostly like this: typedef struct { PyObject_HEAD double x; double y; } Vector; static PyTypeObject Vector_Type = { ... }; It is very simple to create instances of Vector while calling from Python, but I need to create a Vector ins...