tp_members vs. tp_getset slots

Carl Banks imbosol at vt.edu
Thu Dec 5 19:58:36 EST 2002


jsaul wrote:
> But what is the actual difference (not just syntactically) between
> tp_members and tp_getset (if any)? When to use one and when to use
> the other?

There really isn't much of a difference for the cases where they both
work.  I would use tp_members whenever I could, because it's a tad
less work, and a person reading your code will know that the value
stored in the structure is the same value that Python programs see.

There might be a slight speed difference, but probably not much.


-- 
CARL BANKS



More information about the Python-list mailing list