[Edward C. Jones]
Is there a C API for the built-in type set? if not, why not?
I decided not to expose the internals until the code was fully evolved. For Py2.5, the underlying implementation is shifting to use its own data structure instead of forwarding everything to dictionaries. That will save a substantial amount of memory and offer a tiny speed boost. See a fully-tested draft implementation in nondist/sandbox/set. Of course, you already know that you can use the PyObject_Call() and its brethren to access sets and set methods. The regular, external set API works pretty well with this approach (many methods accept any iterable). The only inefficiencies that arise are with fine grained methods like __contains__() and add(); even then, it is no less efficient than pure Python. Raymond Hettinger
participants (3)
-
Barry Warsaw
-
Edward C. Jones
-
Raymond Hettinger