Movatterモバイル変換


[0]ホーム

URL:


[Python-Dev] Discussion draft: Proposed Py2.5 C API for set andfrozenset objects

Raymond Hettingerraymond.hettinger at verizon.net
Sat Aug 13 13:34:34 CEST 2005


The object and types--------------------PySetObject                     subclass of object                                used for both sets and frozensetsPySet_Type                      a basetypePyFrozenSet_Type                a basetypeThe type check macros---------------------PyFrozenSet_CheckExact(ob)      a frozensetPyAnySet_CheckExact(ob)         a set or frozensetPyAnySet_Check(ob)              a set, frozenset, or subclass of eitherThe constructors----------------obj PySet_New(it)               takes an iterable or NULL; returns newrefobj PyFrozenSet_New(it)         takes an iterable or NULL; returns newrefThe fine grained methods------------------------int PySet_Size(so)int PySet_Contains(so, key)     1 for yes; 0 for no; -1 for error                                raises TypeError for unhashable key                                does not automatically convert tofrozenset                                int PySet_Add(so, key)          0 for success; -1 for error                                raises TypeError for unhashable key                                raises MemoryError if no room to growobj PySet_Pop(so)               return new ref or NULL on failure                                raises KeyError if set is emtpyint PySet_Discard(so, key)      1 if found and removed                                0 if not found (does not raise KeyError)                                -1 on error                                raises TypeError for unhashable key                                does not automatically convert tofrozensetCourse grained methods left for access through PyObject_CallMethod()--------------------------------------------------------------------copy, clear, union, intersection, difference, symmetric_difference,update,intersection_update, difference_update, symmetric_difference_updateissubset, issuperset, __reduce__Other functions left for access through the existing abstract API-----------------------------------------------------------------PyObject_RichCompareBool()PyObject_Hash()PyObject_Repr()PyObject_IsTrue()PyObject_Print()PyObject_GetIter()


More information about the Python-Devmailing list

[8]ページ先頭

©2009-2025 Movatter.jp