No subject


Tue Oct 14 00:29:20 CEST 2008


	There are some issues. First, you will note
EVERY method is defined, add, radd, etc -- even for
C++ types you want to define, that aren't numbers of
sequences, etc.

	This really IS a problem, because CPython checks
some things by seeing if the subtable pointer is NULL.
So a pragmatic solution might, indeed, requires several
abstract bases rather than one -- a base for numbers,
another for sequences, etc. [But the number is still
finite and fixed for all C++ extensions].

	The trick in all this is that _constructors_
are not methods. They're ordinary functions that fill
out the Python PyObject struct C_Cpp_PyObject: we construct a 
client C++ object and store the pointer to it in that
struct.

BTW: here is another solution, abstract in principle,
but technically concrete:

	class Cpp_PyObject {
		virtual int len() const { throw "Unimplemented Error"; }
		..
	};


-- 
John Skaller, mailto:skaller at maxtal.com.au
10/1 Toxteth Rd Glebe NSW 2037 Australia
homepage: http://www.maxtal.com.au/~skaller
voice: 61-2-9660-0850




More information about the Cplusplus-sig mailing list