is there an equivalent in C of python's set()?

2019-06-25 13:55发布

问题:

I m seeking some equivalent in C of python's set() variable type any ideas? here is the python doc about sets http://docs.python.org/2/library/sets.html

and could you explain/link me a help for this? please

回答1:

No, there isn't. The Python datatype relies on a lot of things regarding Python objects that the more low-level data you typically work with in C simply don't have.

Like being able to compare two "objects" reliably, regardless of their type or internal structure.

The more you know about your data the easier it will be to roll your own, of course.

I would recommend you look at glib's hash tables if you want to use a library.



标签: python c set