[Python-Dev] PySet API

Barry Warsaw barry at python.org
Mon Mar 20 04:10:36 CET 2006


On Sat, 2006-03-18 at 19:22 -0500, Raymond Hettinger wrote:
> > [Barry Warsaw]
> >> Oh, also, we have a couple of additions to the PySet C API.
> >> I'll work on putting together an SF patch for them over the weekend.
> 
> What are you proposing to add to the PySet API?

PySet_Clear(), PySet_Next(), PySet_Update(), and PySet_AsList().

> I designed an API that was both minimal and complete.  The idea was to provide 
> direct access to fined grained functions and access the rest through the 
> existing abstract API for PyObject and PyNumber as detailed in the Set API docs. 

We use the above functions quite a bit in our embedded app, so we want
them to be as efficient as possible.  They should also be obvious to C
programmers (e.g. using PyNumber_InPlaceSubtract() is much less obvious
than PySet_Clear()).

> I tried out the API to translate  a number of set algorithms and found that the 
> API was easy-to-use and sufficient as-is.  There may be room for variants of the 
> type checking macros, but I would like the rest of the C API to remain as-is 
> unless some compelling deficiency can be shown.  It is easy to expand the API 
> later but almost impossible to take anything back once in the field.

The above mirrors what's available for dict objects, and if you are
using sets for collections of objects, I believe they make the most
sense.

> IOW, if I have I still have a say in the matter, the patch will most likely not 
> be accepted.

Can you explain why the additions above would not be obvious
improvements?

-Barry

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 309 bytes
Desc: This is a digitally signed message part
Url : http://mail.python.org/pipermail/python-dev/attachments/20060319/c32f0cd4/attachment.pgp 


More information about the Python-Dev mailing list