picop.cyset#
Fast set accessors.
- picop.cyset.frozenset_check_exact(p)#
Return True if
type(p) is frozenset.
- picop.cyset.frozenset_empty()#
Return a new empty frozenset via
PyFrozenSet_New(NULL).- Return type:
- picop.cyset.frozenset_eq(a, b)#
Return True if typed frozensets are equal (identity/size short-circuit + richcompare).
- picop.cyset.frozenset_new(iterable)#
Return a new frozenset from
iterableviaPyFrozenSet_New.
- picop.cyset.set_add(s, value)#
Add
valueviaPySet_Add.Notes
Slower than the plain-Python equivalent
s.add(v)(Tier A 1.07x); unchecked set mutation.Returns
0on success; errors raise. Do not use the status int as a bool.
- picop.cyset.set_any_check(p)#
Return True if
pis a set or frozenset (or subtype).
- picop.cyset.set_any_check_exact(p)#
Return True if
type(p) is setorfrozenset(no subtype).
- picop.cyset.set_check_exact(p)#
Return True if
type(p) is set(PySet_CheckExact).
- picop.cyset.set_clear(s)#
Clear
sviaPySet_Clear.Notes
Slower than the plain-Python equivalent
s.clear()(Tier A 1.03x); unchecked set mutation.Returns
0on success; errors raise. Do not use the status int as a bool.
- picop.cyset.set_contains(anyset, value)#
Return whether
valueis inanysetviaPySet_Contains.
- picop.cyset.set_discard(s, value)#
Discard
valueviaPySet_Discard.Notes
Slower than the plain-Python equivalent
s.discard(v)(Tier A 1.04–1.06x); unchecked set mutation.Returns
1if removed,0if absent (noKeyError). Errors raise. Do not treat the status int as a plain bool for success/failure.
- picop.cyset.set_eq(a, b)#
Return True if typed sets are equal (identity/size short-circuit + richcompare).
- picop.cyset.set_len(s)#
Return
len(s)viaPySet_GET_SIZE(exactset).
- picop.cyset.set_new(iterable)#
Return a new set from
iterableviaPySet_New.
- picop.cyset.set_pop(s)#
Return and remove an arbitrary element of
s(PySet_Pop).Notes
Slower than the plain-Python equivalent
s.pop()(Tier A 1.08x); unchecked set mutation.
- picop.cyset.set_size(anyset)#
Return
len(anyset)via checkedPySet_Size.Notes
Accepts set/frozenset/subtypes. Prefer
set_lenon a typed exactsethot path.
- picop.cyset.set_update(s, iterable)#
Update
sfromiterablevia_PySet_Update.Notes
Slower than the plain-Python equivalent
s.update(it)(Tier A 1.07x); unchecked set mutation.Returns
0on success; errors raise. Do not use the status int as a bool.