Hi thanks for the tool! However, sometimes it has a bit confusing semantics. If I understand correctly, it is because that, the auto generated getter indeed does a clone to the underlying object. Thus, in the example below, modification of my_class.sub.num acts on a copy of MySubClass object, instead of the original object on my_class.
(base) ➜ hello_pyo3 maturin develop && python hi.py
🔗 Found pyo3 bindings
🐍 Found CPython 3.9 at /Users/tom/opt/anaconda3/bin/python
Compiling hello_pyo3 v0.1.0 (/Volumes/MyExternal/ExternalRefCode/hello_pyo3)
Finished dev [unoptimized + debuginfo] target(s) in 0.30s
📦 Built wheel for CPython 3.9 to /var/folders/j5/j6ymn7yd70564hzt31pq_0g80000gn/T/.tmpDJxqpB/hello_pyo3-0.1.0-cp39-cp39-macosx_10_12_x86_64.whl
🛠 Installed hello_pyo3-0.1.0
my_class=<builtins.MyClass object at 0x7f7ff00c1e70> my_class.sub=<builtins.MySubClass object at 0x7f80100e83f0> my_class.sub.num=100
my_class=<builtins.MyClass object at 0x7f7ff00c1e70> my_class.sub=<builtins.MySubClass object at 0x7f80100e83f0> my_class.sub.num=100
my_class=<builtins.MyClass object at 0x7f7ff00c1e70> my_class.sub=<builtins.MySubClass object at 0x7f80100e83f0> my_class.sub.num=200
Backtrace
No response
Your operating system and version
-
Your Python version (python --version)
-
Your Rust version (rustc --version)
-
Your PyO3 version
latest
How did you install python? Did you use a virtualenv?
Bug Description
Hi thanks for the tool! However, sometimes it has a bit confusing semantics. If I understand correctly, it is because that, the auto generated getter indeed does a clone to the underlying object. Thus, in the example below, modification of
my_class.sub.num
acts on a copy of MySubClass object, instead of the original object onmy_class
.Steps to Reproduce
Backtrace
No response
Your operating system and version
-
Your Python version (
python --version
)-
Your Rust version (
rustc --version
)-
Your PyO3 version
latest
How did you install python? Did you use a virtualenv?
-
Additional Info
No response