Manipulating sets from the 2.4 C API?

Felipe Almeida Lessa felipe.lessa at gmail.com
Tue Apr 11 13:07:39 EDT 2006


Em Ter, 2006-04-11 às 18:55 +0200, "Martin v. Löwis" escreveu:
> 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);

I don't know much about the C API, but I'll ask anyway: the methods,
say, PySet, would be included for clarity/brevity or for performance
reasons?

-- 
Felipe.




More information about the Python-list mailing list