'static' class properties in extension types

Tim Goetze ggrp at quitte.de
Wed Dec 5 07:36:39 EST 2001


ggrp at quitte.de (Tim Goetze) wrote in message news:<e58a1d8d.0112010648.79ee5793 at posting.google.com>...
> class C:
>   const = 1
> 
> can somebody tell me if, and how I can create the equivalent of
> 'C.const' if C is not a Python class, but a type implemented in a C
> extension module?

no question shall ever remain unanswered:

PyType_Ready (my_type)
PyDict_SetItemString (my_type->tp_dict, "const", PyInt_FromLong (1));

in case somebody else wonders, too ;)



More information about the Python-list mailing list