picop.cyset#

Fast set accessors.

picop.cyset.frozenset_check(p)#

Return True if p is a frozenset or subtype. :type p: object :param p:

Return type:

bool

Parameters:

p (object)

picop.cyset.frozenset_check_exact(p)#

Return True if type(p) is frozenset. :type p: object :param p:

Return type:

bool

Parameters:

p (object)

picop.cyset.frozenset_empty()#

Return a new empty frozenset via PyFrozenSet_New(NULL).

Return type:

frozenset

picop.cyset.frozenset_eq(a, b)#

Return True if typed frozensets are equal (identity/size short-circuit + richcompare). :type a: frozenset :param a: :type b: frozenset :param b:

Return type:

bool

Parameters:
picop.cyset.frozenset_new(iterable)#

Return a new frozenset from iterable via PyFrozenSet_New. :type iterable: object :param iterable:

Return type:

frozenset

picop.cyset.set_add(s, value)#

Add value via PySet_Add.

Notes

Returns 0 on success; errors raise. Do not use the status int as a bool.

Parameters:
Return type:

int

picop.cyset.set_any_check(p)#

Return True if p is a set or frozenset (or subtype). :type p: object :param p:

Return type:

bool

picop.cyset.set_any_check_exact(p)#

Return True if type(p) is set or frozenset (no subtype). :type p: object :param p:

Return type:

bool

picop.cyset.set_check(p)#

Return True if p is a set or subtype (PySet_Check). :type p: object :param p:

Return type:

bool

Parameters:

p (object)

picop.cyset.set_check_exact(p)#

Return True if type(p) is set (PySet_CheckExact). :type p: object :param p:

Return type:

bool

Parameters:

p (object)

picop.cyset.set_clear(s)#

Clear s via PySet_Clear.

Notes

Returns 0 on success; errors raise. Do not use the status int as a bool.

Parameters:

s (set)

Return type:

int

picop.cyset.set_contains(anyset, value)#

Return whether value is in anyset via PySet_Contains. :type anyset: object :param anyset: :type value: object :param value:

Return type:

bool

Parameters:
picop.cyset.set_copy(s)#

Shallow-copy s via PySet_New(s). :type s: set :param s:

Return type:

set

picop.cyset.set_discard(s, value)#

Discard value via PySet_Discard.

Notes

Returns 1 if removed, 0 if absent (no KeyError). Errors raise. Do not treat the status int as a plain bool for success/failure.

Parameters:
Return type:

int

picop.cyset.set_empty()#

Return a new empty set via PySet_New(NULL).

Return type:

set

picop.cyset.set_eq(a, b)#

Return True if typed sets are equal (identity/size short-circuit + richcompare). :type a: set :param a: :type b: set :param b:

Return type:

bool

Parameters:
picop.cyset.set_len(s)#

Return len(s) via PySet_GET_SIZE (exact set). :type s: set :param s:

Return type:

int

Parameters:

s (set)

picop.cyset.set_new(iterable)#

Return a new set from iterable via PySet_New. :type iterable: object :param iterable:

Return type:

set

picop.cyset.set_pop(s)#
picop.cyset.set_size(anyset)#

Return len(anyset) via checked PySet_Size.

Notes

Accepts set/frozenset/subtypes. Prefer set_len on a typed exact set hot path.

Parameters:

anyset (object)

Return type:

int

picop.cyset.set_update(s, iterable)#

Update s from iterable via _PySet_Update.

Notes

Returns 0 on success; errors raise. Do not use the status int as a bool.

Parameters:
Return type:

int