[Tutor] why PyObject_VAR_HEAD?

Eric Zhao ericzhao at microsoft.com
Thu Jun 25 05:49:56 CEST 2009


Hi,

I'm studying the CPython source code. I don't quite understand why they're using PyObject_VAR_HEAD to define struct like PyListObject. To define such kind of struct, could I use _PyObject_HEAD_EXTRA as a header and add "items" pointer and "allocated" count explicity? Is there any difference?

Thanks.

Eric


More information about the Tutor mailing list