Manipulating sets from the 2.4 C API?

"Martin v. Löwis" martin at v.loewis.de
Tue Apr 11 12:55:49 EDT 2006


Dave Opstad wrote:
> If I want to handle sets should I just use a dictionary's keys and 
> ignore the values, or is there some more explicit set support somewhere 
> I'm not seeing?

Indeed, there is. To create a new set, do

   PyObject_Call(PySet_Type, "");

To, say, invoke the add method, do

   PyObject_CallMethod(s, "add", "O", o);

HTH,
Martin



More information about the Python-list mailing list