Create new instance of Python class in C
dwelch at vcd.hp.com
Fri Sep 9 18:16:37 CEST 2005
Sybren Stuvel wrote:
> Hi people,
> I'm creating a program that can solve and create Sudoku puzzles. My
> creation function needs to make a lot of copies of a puzzle. Until
> now, I used copy.deepcopy(), but that's too slow. I want to implement
> such a copying function in C and use that instead. My idea about this
> - Get the data from a puzzle (a list containing lists containing
> strings) and make a copy of it. That's coded already.
> - Create a new SodokuPuzzle instance and assign the data to it.
> That last step can be done by passing the data to the constructor, so
> that's easy too once I know how to do that in C. My question is: how
> do I create a new instance in C of a class written in Python? I've
> searched Google, but found nothing of help.
Personally, I would try Psyco first, and consider Pyrex next. Are you
sure your algorithm can't be optimized first, before you start trying to
write this in C?
More information about the Python-list