MCPcopy Create free account
hub / github.com/pybind/pybind11 / len

Function len

include/pybind11/pytypes.h:2551–2557  ·  view source on GitHub ↗

Get the length of a Python object.

Source from the content-addressed store, hash-verified

2549
2550/// Get the length of a Python object.
2551inline size_t len(handle h) {
2552 ssize_t result = PyObject_Length(h.ptr());
2553 if (result < 0) {
2554 throw error_already_set();
2555 }
2556 return static_cast<size_t>(result);
2557}
2558
2559/// Get the length hint of a Python object.
2560/// Returns 0 when this cannot be determined.

Callers 15

runFunction · 0.85
libsize.pyFile · 0.85
test_ctypes_array_1dFunction · 0.85
test_ctypes_array_2dFunction · 0.85
test_ctypes_from_bufferFunction · 0.85
test_sequenceFunction · 0.85
test_map_iteratorFunction · 0.85
TEST_SUBMODULEFunction · 0.85

Calls 1

ptrMethod · 0.80

Tested by 15

test_ctypes_array_1dFunction · 0.68
test_ctypes_array_2dFunction · 0.68
test_ctypes_from_bufferFunction · 0.68
test_sequenceFunction · 0.68
test_map_iteratorFunction · 0.68
TEST_SUBMODULEFunction · 0.68
_run_in_processFunction · 0.68