Skip to content

Commit fc77747

Browse files
committed
Fully explain the terse variable naming scheme in test_class_sh_property (as suggested by @rainwoodman)
1 parent 07c807c commit fc77747

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

.codespell-ignorelines

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ atyp_valu rtrn_valu() { atyp_valu obj{"Valu"}; return obj; }
1111
valu = other.valu;
1212
with pytest.raises(ValueError) as excinfo:
1313
with pytest.raises(ValueError) as exc_info:
14+
// valu(e), ref(erence), ptr or p (pointer), r = rvalue, m = mutable, c = const,

tests/test_class_sh_property.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
// The compact 4-character naming matches that in test_class_sh_basic.cpp
2+
// Variable names are intentionally terse, to not distract from the more important C++ type names:
3+
// valu(e), ref(erence), ptr or p (pointer), r = rvalue, m = mutable, c = const,
4+
// sh = shared_ptr, uq = unique_ptr.
5+
16
#include "pybind11/smart_holder.h"
27
#include "pybind11_tests.h"
38

@@ -19,8 +24,6 @@ struct Field {
1924
};
2025

2126
struct Outer {
22-
// The compact 4-character naming matches that in test_class_sh_basic.cpp
23-
// (c = const, m = mutable).
2427
Field m_valu;
2528
Field *m_mptr = nullptr;
2629
const Field *m_cptr = nullptr;

tests/test_class_sh_property.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# The compact 4-character naming scheme (e.g. mptr, cptr, shcp) is explained at the top of
2+
# test_class_sh_property.cpp.
3+
14
import pytest
25

36
import env # noqa: F401

0 commit comments

Comments
 (0)