Re: why PyObject_VAR_HEAD?

2009-07-07 Thread Eric Wong
kio wrote: 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

why PyObject_VAR_HEAD?

2009-06-29 Thread kio
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?

Re: why PyObject_VAR_HEAD?

2009-06-29 Thread Benjamin Peterson
kio lehchao at gmail.com writes: 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