Skip to content

Document that struct binding getters return a copy of a value and propagating any changes must go through the setter #262

@vzhurba01

Description

@vzhurba01

https://github.com/NVIDIA/cuda-python/pull/261/files/4abe5206ac75224a1e03a1198a10f1daa5eec2f0#r1867071402

As uncovered here, there's a lack of clarity in how attributes get packaged for Cython's Extension Types. While the bindings outwardly presents their attributes in a Pythonic way, they can't always be interacted with in a Pythonic style. Often the getters/setters is actually a translation step to convert values between Python and C.

In this specific example, the setter makes sure that the Python list elements are packages in a contiguous memory for C consumption. The getter returns a copy of each element in a Python list. Both behaviors are unnatural for Python users and we should document that there's an emphasis to use the getter/setter directly.

Metadata

Metadata

Assignees

Labels

P1Medium priority - Should docuda.bindingsEverything related to the cuda.bindings moduledocumentationImprovements or additions to documentation

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions