picop.protocols#

Category facade: abstract Protocols (mapping / sequence / number / object).

Provisional after 1.0 — not part of the Core freeze. Prefer picop.containers / picop.hot when you know dict / list / tuple / …. Use this facade only when the concrete type is unknown. May still evolve under post-1.0 minors.

picop.protocols.map_check(o)#

Return True if o provides the mapping protocol. :type o: object :param o:

Return type:

bool

Parameters:

o (object)

picop.protocols.map_eq(a, b)#

Return True if mappings are equal via identity/size short-circuit + richcompare.

Notes

Prefer dict_eq when both operands are known dict instances.

Parameters:
Return type:

bool

picop.protocols.map_has_key(o, key)#

Return True if mapping o has key. :type o: object :param o: :type key: object :param key:

Return type:

bool

Parameters:
picop.protocols.seq_check(o)#

Return True if o supports the sequence protocol (PySequence_Check). :type o: object :param o:

Return type:

bool

Parameters:

o (object)

picop.protocols.seq_eq(a, b)#

Return True if sequences are equal via identity/size short-circuit + richcompare.

Notes

Prefer list_eq / tuple_eq when both operands are typed.

Parameters:
Return type:

bool

picop.protocols.seq_get(o, i)#

Return o[i] via PySequence_GetItem. :type o: object :param o: :type i: int :param i:

Return type:

object

Parameters:
picop.protocols.seq_contains(o, value)#

Return value in o via PySequence_Contains. :type o: object :param o: :type value: object :param value:

Return type:

bool

Parameters:
picop.protocols.num_check(o)#

Return True if o provides the number protocol (PyNumber_Check). :type o: object :param o:

Return type:

bool

Parameters:

o (object)

picop.protocols.num_eq(a, b)#

Return True if a == b via richcompare (abstract number; NaN parity). :type a: object :param a: :type b: object :param b:

Return type:

bool

Parameters:
picop.protocols.obj_eq(a, b)#

Return True if a == b via PyObject_RichCompareBool.

Notes

Identity short-circuit applies. Prefer typed *_eq when both operands have a known Core type.

Parameters:
Return type:

bool