According to Python documentation, implementing a class in C for Python can be roughly divided into three steps:
- defining the Object (the data impl)
- defining the Type (the behavior wrapper)
- defining concrete behaviors, and set them into corresponding
tp_xxslots
For new function, init function, instance members, attributes, and even dealloc, all of them can be found a slot in PyTypeObject declaration, like tp_new, tp_init, tp_members, tp_methods and tp_dealloc. But there is not a slot like tp_statics.
Where should I declare the static variables and where should I set them up? I searched for the internet but got nothing. Could anyone give me a clue about this?