defining class

Fredrik Lundh fredrik at effbot.org
Sat Jan 27 06:47:24 EST 2001


Chris Gonnerman wrote:
> That's because it isn't easy, AFAIK.  Check out the Boost Python Library at
> http://www.boost.org/libs/python/doc/index.html; on the page on writing
> extensions they say:
>
> > Another obstacle that most people run into eventually when extending
> > Python is that there's no way to make a true Python class in an extension
> > module.

"no way" is a little strong, given that Python's "exceptions" module is
written in C, and it defines more classes than most other modules...

see the make_class and populate_methods in Python/exceptions.c
for details.

Cheers /F





More information about the Python-list mailing list