Creating custom types from C code

Stefan Behnel stefan_ml at behnel.de
Mon Dec 20 11:44:27 EST 2010


Eric Frederich, 20.12.2010 16:23:
> I remember reading about named tuples when they were back-ported to the
> 2.X series but I never played with them. Is there a way to instantiate a
> named tuple from C code?

There isn't a dedicated C-API for named tuples, but you can instantiate any 
Python type from C code.


> Maybe I'm over-thinking this whole thing. Is there a simple way that I
> can define a class in Python and instantiate that type from C?

Sure, see my previous comments to your original mail.

Stefan




More information about the Python-list mailing list