picop.cyarray#

Fast array.array helpers (Cython cpython.array surface).

picop.cyarray.array_check(p)#

Return True if p is an array.array (isinstance). :type p: object :param p:

Return type:

bool

Parameters:

p (object)

picop.cyarray.array_check_exact(p)#

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

Return type:

bool

Parameters:

p (object)

picop.cyarray.array_clone(template, length, zero=True)#

Return a new array like template with length items.

Notes

Optionally zero-fills the new buffer when zero is true.

Parameters:
Return type:

array

picop.cyarray.array_copy(a)#

Return a shallow copy of a via Cython array.copy. :type a: array :param a:

Return type:

array

picop.cyarray.array_eq(a, b)#

Return True if typed array.array values are equal.

Notes

Compares typecode/len then memcmp.

Parameters:
Return type:

bool

picop.cyarray.array_extend(self, other)#

Extend self from other via Cython array.extend.

Notes

Requires the same typecode. Returns 0 on success and -1 on error; errors raise. Do not use the status int as a bool.

Parameters:
Return type:

int

picop.cyarray.array_len(a)#

Return len(a) via Py_SIZE. :type a: array :param a:

Return type:

int

Parameters:

a (array)

picop.cyarray.array_ne(a, b)#

Return True if typed array.array values differ (not array_eq). :type a: array :param a: :type b: array :param b:

Return type:

bool

Parameters:
picop.cyarray.array_resize(a, n)#

Resize a to n elements via Cython array.resize.

Notes

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

Parameters:
Return type:

int

picop.cyarray.array_resize_smart(a, n)#

Resize a to n via Cython array.resize_smart.

Notes

Small-grow friendly. Returns 0 on success and -1 on error; errors raise. Do not use the status int as a bool.

Parameters:
Return type:

int

picop.cyarray.array_zero(a)#

Zero all elements of a via memset.

Notes

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

Parameters:

a (array)

Return type:

int