Skip to content

Commit 6d0109c

Browse files
committed
Fix comment about name shadowing
1 parent e82804d commit 6d0109c

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎cuda_bindings_13/docs/source/module/v2_migration.rst‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ Naming
4040
- Functions use ``snake_case`` with the ``cu``/``nvrtc`` prefix removed
4141
(``cuStreamCreate`` becomes ``stream_create``). Driver functions keep the version suffix of
4242
the C symbol (``mem_alloc_v2``), whereas the legacy module drops it.
43-
- Parameters and struct members use ``snake_case``. Names that would clash with a Python keyword or
44-
builtin, or with a name reserved by the generated classes, get a trailing underscore (``input_``, ``flags_``).
43+
- Parameters and struct members use ``snake_case``. A parameter that is a Python keyword gets a
44+
trailing underscore (``from_``). Python builtin names such as ``type`` and ``object`` are kept as they are.
45+
A struct member whose name would shadow an attribute of the class (``ptr``) or of the NumPy array that backs
46+
struct arrays (``data``, ``flags``, ``size``, ``device``) also gets a trailing underscore (``flags_``, ``data_``).
4547
- Enumeration classes and structs use ``CamelCase`` with the ``CU``/``nvrtc`` prefix removed.
4648
Structs keep their C version suffix (``MemLocation_v1``) and there is a single class per
4749
versioned C type instead of several aliases.

0 commit comments

Comments
 (0)